【问题标题】:enable landscape orientation in only one view on ios 6在 ios 6 上仅在一个视图中启用横向
【发布时间】:2013-02-28 07:23:10
【问题描述】:
-(NSUInteger)supportedInterfaceOrientations
{           
    return UIInterfaceOrientationMaskPortrait;
}

-(BOOL)shouldAutorotate
{
    return NO;
}

我只想在我的应用的一个视图中启用横向。其他视图必须仅支持纵向模式。但是对于 iOS 6,即使我使用的是 iOS 6 的最新方法,它也会自动旋转。期待正确的建议。

【问题讨论】:

  • 谢谢.. 但使用链接中的方法仍然支持方向。我想要纵向,除了一个支持横向和纵向两种视图。
  • 不,它只是不工作..我之前尝试过..主要问题出在 iOS 6 中。

标签: iphone ios ios5 ios6


【解决方案1】:

对于仅纵向方向,请尝试以下方法

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
}

- (BOOL)shouldAutorotate {
    return FALSE;
}

【讨论】:

    猜你喜欢
    • 2016-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-15
    • 1970-01-01
    相关资源
    最近更新 更多