我正在使用带有 4 个 UINavigationController 的 UITabBarController。
在第四个 ViewController 中,我想将其方向限制为仅纵向, 我正在使用以下方法,但这些方法对我不起作用, 请帮助我。
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
最佳答案
现在我使用自定义的 UITabBarController 如下...
CustomTabBarController.m
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
和
在 ViewControllerToBePorted.m 中
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeLeft;
}
-(BOOL)shouldAutorotate{
return NO;
}
感谢回复..
关于ios - 如何在 iOS 6 中强制方向为纵向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19679358/