IOS Autolayout rotation application crash

  • When I launch the application in portrait mode, and I rotate the screen to the landscape, then the restrictions work fine.

  • When I run the application in portrait mode and present the model and I rejected the model view controller. then I turn the screen into an album so that the restrictions do not work.

  • When I launch the application and turn into landscape mode, and when I submit the model view controller, the application receives a failure, a failure report and then,

The model view controller contains a restricted navigation panel (superiew.trailing using navigationbar.trailing, superview.leading with navigationbar.leading and navigationbar.top using TopLayoutGuide.Bottom). all are 0-constants.

The application terminated due to the unannounced exception "NSInternalInconsistencyException", reason: "Autolayout does not support intersecting rotation boundaries, limits layout borders such as right, left, upper, lower. Offensive view: <UITransitionView: 0x8dd5300; frame = (0 0; 320 568); transform = [0, -1, 1, 0, 0, 0]; clipsToBounds = YES; autoresize = H; layer = <CALayer: 0x8dd3980 →

Step. Create a new application based on one view and add a ViewedededbackbackImageView image and the following limitations.

NSLayoutConstraint *backgroundImageConstraints1 = [NSLayoutConstraint constraintWithItem:_backgroundImageView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1 constant:0];

NSLayoutConstraint *backgroundImageConstraints2 = [NSLayoutConstraint constraintWithItem:_backgroundImageView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1 constant:0];

NSLayoutConstraint *backgroundImageConstraints3 = [NSLayoutConstraint constraintWithItem:_backgroundImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeHeight multiplier:1 constant:0];

NSLayoutConstraint *backgroundImageConstraints4 = [NSLayoutConstraint constraintWithItem:_backgroundImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth multiplier:1 constant:0];

Then add a button that accepts the controller of the second view as PresentModelView. second view Contains only the NavigationBar, which shows the image below.

SecondViewController Screen

+4
1

, .

  • .
  • , .
  • , , , " ".

enter image description here

  1. " ", .

,


, , .

0

Source: https://habr.com/ru/post/1532664/


All Articles