I want to make a landscape iPad app. I did below 3 things. the simulator orientation is landscape which is correct. However, the content is 90 degrees wrong, but they are right in the storyboard view, landscape. Is there anything I need to check?
I set my storyboard as landscape.
May project I already set "supported interface orientations" = landscape
Also used this code in view controller:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight) return YES; else return NO; }
Supported Interface Orientations is one thing. It didn't work for me until I did the following:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
You have to use the following code on ALL of your viewcontrollers
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
}
确保在Info.plist中也设置了“初始界面方向”。
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.