【问题标题】:ipad rotation problem in a view based app using uinavigationcontroller使用 uinavigationcontroller 的基于视图的应用程序中的 ipad 旋转问题
【发布时间】:2011-06-17 05:17:50
【问题描述】:

我是第一次为 ipad 创建一个应用程序。 我创建了一个基于视图的应用程序,并在 appdelegate 中添加了 uinavigationcontroller。 在 myappviewController(myapp 是项目名称)屏幕正在旋转。然后我创建了一个新文件(右键单击类文件夹->添加->新文件->ios cocoa touch 类->UIViewController 子类。 现在我正在使用

推送这个视图
    [self.navigationcontroller pushviewcontroller:secondview animated:YES];

现在这个视图没有旋转。 shouldAutoRotateToInterfaceOrientation 在两个文件中都返回 YES。 请帮帮我。

【问题讨论】:

    标签: iphone objective-c ios4 uinavigationcontroller uiinterfaceorientation


    【解决方案1】:

    试试:

    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    }
    

    【讨论】:

    • 现在两个视图都没有旋转,但是当我尝试 [self presentModalViewController:t animated:YES];横向加载的第二个视图
    • 抱歉误解了您的问题,您以为您想将视图旋转到横向模式;p 您在创建第二个视图时是否选中了“Targeted for iPad”?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多