IOS cannot authorize subviews while rotating device

I tried several solutions found on other posts, but still experiencing problems with auto-resolution of subviews while rotating the device. My Layout (IB) has three views and applies only to the size of the current view. If then, after turning the device, the view is displayed, has not been changed and remains in the previous measurements. I install autoresize subviews and its mask ... What am I doing wrong or missing? any help would be appreciated, thanks!

- (void)viewDidLoad { [super viewDidLoad]; [self.view setAutoresizesSubviews:YES]; [self.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; [vistaSocial setAutoresizesSubviews:YES]; [vistaSocial setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; [vistaB setAutoresizesSubviews:YES]; [vistaB setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; 
+4
source share
3 answers

For this view, in order to adjust its size when the device rotates, its supervisor must have the autoresizesSubviews property set to YES . (It’s not clear from your code snippet what your presentation hierarchy is.) Try changing

 [vistaB setAutoresizesSubviews:YES]; 

to

 [vistaB.superview setAutoresizesSubviews:YES]; 
+1
source

I think you are not using the correct resizing properties in the xib file. In my opinion, you should add 2-3 views to the current controller; but automatic resizing is getting somewhere wrong. Try one after another and with the right set. You can share any screenshot for a better understanding if I predict this incorrectly.

+2
source

You can set the Autoresize property using a Nib file. Can you check how to properly install it from a NIB file?

+2
source

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


All Articles