iOS AutoLayout issue with ScrollView

后端 未结 3 1312
借酒劲吻你
借酒劲吻你 2021-01-21 11:33

Hello i have an auto layout issue with UIScrollView and ModalViewController. Here are my coding steps as sample code:

1) I have an UIView

3条回答
  •  离开以前
    2021-01-21 11:51

    From the documentation of UIViewController's presentViewController: method:

    This method sets the presentedViewController property to the specified view controller, resizes that view controller’s view and then adds the view to the view hierarchy. The view is animated onscreen according to the transition style specified in the modalTransitionStyle property of the presented view controller.

    So the resizing of your view controller is intended. Well, by Apple, anyway.

    One way to go about this is to log the resized view's coordinates and infer what exactly has been changed. Maybe you can adjust your constraints in a way to prevent this.

    Alternatively, you could try resizing everything in the completion handler of this method.

提交回复
热议问题