我只想在横向模式下制作屏幕。对ios5来说工作很好。但在iOS 7中,它不起作用。我使用以下代码在ios7中提供支持。ios7不支持横向方向
-(BOOL)shouldAutorotate{return TRUE;}
-(NSUInteger)supportedInterfaceOrientations{return UIInterfaceOrientationMaskLandscape;}
它不会接到所有屏幕的呼叫。 谢谢。 AKS。
我只想在横向模式下制作屏幕。对ios5来说工作很好。但在iOS 7中,它不起作用。我使用以下代码在ios7中提供支持。ios7不支持横向方向
-(BOOL)shouldAutorotate{return TRUE;}
-(NSUInteger)supportedInterfaceOrientations{return UIInterfaceOrientationMaskLandscape;}
它不会接到所有屏幕的呼叫。 谢谢。 AKS。
- (BOOL)shouldAutorotate
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation==UIDeviceOrientationLandscapeRight || orientation==UIDeviceOrientationLandscapeLeft) {
return YES;
}
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
但问题是,当导航到下一个屏幕时,它没有接到呼叫。 – AKS
从您的根控制器中,调用viewController中的shouldAutorotate。如果您使用导航控制器,则可以使用[self.navigationcontroller topViewController]显示控制器。在rootViewController的shouldAutorotate中写入“[topviewcontroller shouldAutorotate];” –
如果其他人有这个问题,我写了一篇关于它的博客文章。我也遇到了很多麻烦。 http://www.jmeveryday.com/ios7-device-orientation/
系统会要求root viewController获取方向信息。确保你的代码在rootVC – Jing
我写了这个代码在视图controller.m。它第一次接到电话。但在导航到下一个屏幕后没有打电话。 – AKS
您使用UINavigationController从A移动到B?如果是这样,你应该继承UINavigationController,并在那里写代码。您在A中编写的代码将不起作用 – Jing