简体   繁体   中英

Autoresizing masks do not work programmatically

It is necessary to expand the view depending on the device, if the mask exhibit in the storyboard everything works. IMAGE STORYBOARD SETTINGS

if use the programmatically:

viewTest.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;

That the transition to SE for iPhone 7 view does not expand, I think the problem is that you have to ask where that is necessary to expand the SE, but here's how to do it do not know.

In this case I use

view.autoresizingMask = ( UIViewAutoresizingFlexibleWidth |
                          UIViewAutoresizingFlexibleLeftMargin |
                          UIViewAutoresizingFlexibleRightMargin |
                          UIViewAutoresizingFlexibleHeight
                         );

and works like when i create view in storyboard and set the frame flexible.

I think because the system needs also the margins

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM