iOS 7 中的方向问题
orientation issue in iOS 7
我有一个奇怪的问题,我的应用程序处于横向模式。它在 iOS 8 中工作正常,但在 iOS 7 中,应用程序的第一个屏幕进入纵向模式。如果我推到其他 viewController 并返回到第一个 vc,然后它进入我想要的横向模式
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
我还遇到了关于方向的问题...那是在 iPhone。
而且我记得 运行 设置我的应用程序时,默认方向是纵向,而我想要的是将我的应用程序默认设置为横向模式。所以我把代码放在下面,它解决了我的问题。
- (BOOL) shouldAutorotate {
return YES;
}
- (NSUInteger) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
shouldAutorotate returns 是因为我一开始想让它在风景中旋转 运行.
希望故事对你有帮助,祝你好运。
我有一个奇怪的问题,我的应用程序处于横向模式。它在 iOS 8 中工作正常,但在 iOS 7 中,应用程序的第一个屏幕进入纵向模式。如果我推到其他 viewController 并返回到第一个 vc,然后它进入我想要的横向模式
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
我还遇到了关于方向的问题...那是在 iPhone。
而且我记得 运行 设置我的应用程序时,默认方向是纵向,而我想要的是将我的应用程序默认设置为横向模式。所以我把代码放在下面,它解决了我的问题。
- (BOOL) shouldAutorotate {
return YES;
}
- (NSUInteger) supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
shouldAutorotate returns 是因为我一开始想让它在风景中旋转 运行.
希望故事对你有帮助,祝你好运。