Reputation: 589
I am using Xcode 4.2 to develop a storyboard application.
I am trying to rotate views but it is not working. I made sure that the app supports the 4 rotations in the summary as well as in the "info" section.
I have two types of supported orientations:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) { //check if device is iPad
return YES;
}
else
return NO;
}
and
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
I tried it on the iPhone simulator and it is not working, but for the iPad it works perfectly fine... any reasons?
I am using a Tab Bar view controller if this makes any difference ...
Upvotes: 0
Views: 1155
Reputation: 46608
from this document
All child view controllers in your UITabBarController or UINavigationController do not agree on a common orientation set. To make sure that all your child view controllers rotate correctly, you must implement shouldAutorotateToInterfaceOrientation for each view controller representing each tab or navigation level. Each must agree on the same orientation for that rotate to occur. That is, they all should return YES for the same orientation positions.
so make sure all view controller in your tab bar controller return YES
for shouldAutorotateToInterfaceOrientation:
Upvotes: 1