您的位置:首页 > 移动开发

ios6.0之后单个屏幕旋转,不用根视图以及Application windows are expected to have a root view controller at the end of

2013-05-27 17:13 656 查看
ios6.0之后的屏幕旋转: 之前6.0之前的方法是- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

{

    return toInterfaceOrientation == UIInterfaceOrientationLandscapeRight ;
}

但是ios6.0之后就不支持了,不过要实现两个方法:

- (BOOL)shouldAutorotate

{

    return YES;

}

- (NSUInteger)supportedInterfaceOrientations

{

   //这里要注意的是不要用了UIInterfaceOrientationLandscapeRight,这个属性不支持,由于我的大意搞了很久才发现了

    return UIInterfaceOrientationMaskLandscapeRight;

}

现在运行,屏幕就会向右旋转了..

Application windows are expected to have a root view controller at the end of application launch 运行项目的时候出现了这个提示:

解决办法是: self.window.rootViewController = navigation;

不能用 [self.window addSubview:navigation.view] 这个方法了.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS 应用 iOS 6 Xcode
相关文章推荐