I would like to add the functionality to change the screen orientation for various views in my app. Having read various tutorials, I implemente开发者_Python百科d the shouldAutorotateToInterfaceOrientation method in each of my view controllers, and got each of them to return yes, as well as log the call to the console, like this:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
NSLog(@"shouldAutorotateToInterfaceOrientation called");
return YES;
}
When I run this on the simulator and change the orientation, I get the log message but nothing on the screen changes. I've tried to find how this could happen but everywhere I've looked says problems are associated with the method not being called, even though it is in my case. Any ideas?
Thanks
I need to know that in your code are you using every views by code or .xib.
Also you need to set autorisizing property for every component...
Solved it: there was a direct UIViewController object being initialised in the code, and changing it to my own simple base class solved the issue. Thanks for the advice!
精彩评论