简体   繁体   中英

iOS7 changes UIView width

I discovered this problem only on iOS7, so I assume that it's related to the new iOS, although I could be wrong...

So, I have the main UIView - self.view . It's width is set to 320.0 in IB, and nowhere in the code do I change the frame size. However, when I load the view controller for the first time (say, launch the app), the self.view.frame.size.width is set to 310.0 (so says the NSLog ). Then when I leave the view controller and come back to it again, it's 320.0 again as expected.

Any ideas as to why this is happening?

Be sure that there are no constraints, by using Interface Builder, causing your view to behave differently at runtime.

Often IB will warn you if view elements will not appear where you would expect, and new with Xcode 5 you can easily remove all constraints, then add back in what you need one at a time.

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