简体   繁体   中英

shouldAutorotateToInterfaceOrientation not working in an universal app

I have written an universal application and i have returned YES in the "shouldAutorotateToInterfaceOrientation" method. The method is getting called but whenever I change the orientation of Iphone or Ipad the view does not rotate. I have even set the autoresizesSubviews

This is mainly due because some other innerview does not allow/set the orientation change. To make things clear, when you rotate the device, the method shouldAutorotateToInterfaceOrientation will be called for every viewcontroller that hangs on your view tree. If any of them returns NO, the interface won't change.

For example, if you have a tabbarcontroller with viewcontrollers A, B, C and D, the method will be called for all of them, doesn't matter if it is being shown right now.

So be sure that you have changed it in all views.

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