【问题标题】:Make app start and remain in landscape mode让应用程序启动并保持横向模式
【发布时间】:2011-06-15 04:38:36
【问题描述】:

如何以横向模式启动我的应用,并保持屏幕旋转?

【问题讨论】:

    标签: objective-c ios cocoa-touch landscape uiinterfaceorientation


    【解决方案1】:
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
     return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
       interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    } 
    

    【讨论】:

      【解决方案2】:

      实现视图控制器的shouldAutorotateToInterfaceOrientation:方法和return UIInterfaceOrientationIsLandscape(orientation);

      还将Info.plistUIInterfaceOrientationUISupportedInterfaceOrientations 设置为UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientation 将采用单个值,因此分配其中一个并将它们都分配给 UISupportedInterfaceOrientations

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-05-18
        • 2012-03-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多