关闭

ios6方向旋转问题

58人阅读 评论(0) 收藏 举报
方向问题:
1.appdelegate里面添加:
//iOS6 才会调用
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    return (UIInterfaceOrientationMaskAll);
}
2.相应的controller里面添加:
//iOS6
- (BOOL)shouldAutorotate{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
    if (self.bookModel.bookOrientation == BookOrientationLandscape) {
        return UIInterfaceOrientationMaskLandscape;
    }
    else {
        return UIInterfaceOrientationMaskPortraitUpsideDown|UIInterfaceOrientationMaskPortrait;
    }
}

//iOS5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
    if (self.bookModel.bookOrientation == BookOrientationLandscape) {
         return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
    }
    else {
         return UIInterfaceOrientationIsPortrait(toInterfaceOrientation);
    }
}

3.plist里面添加相应的方向支持.

注意:ios6里面appdelegate里面要添加方向支持才可以.
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:793次
    • 积分:21
    • 等级:
    • 排名:千里之外
    • 原创:1篇
    • 转载:3篇
    • 译文:0篇
    • 评论:0条
    文章存档