关闭

UINavigationController

标签: navigaitoncontroller
457人阅读 评论(0) 收藏 举报
分类:

UINavigationController处理屏幕旋转A simple UINavigationController subclass to handle iOS 6’s orientation changes better

#import <UIKit/UIKit.h>

@interface CJProperRotationNavigationController : UINavigationController

@end

#import "CJProperRotationNavigationController.h"

@implementation CJProperRotationNavigationController

- (BOOL)shouldAutorotate {
    if (self.topViewController != nil)
        return [self.topViewController shouldAutorotate];
    else
        return [super shouldAutorotate];
}

- (NSUInteger)supportedInterfaceOrientations {
    if (self.topViewController != nil)
        return [self.topViewController supportedInterfaceOrientations];
    else
        return [super supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    if (self.topViewController != nil)
        return [self.topViewController preferredInterfaceOrientationForPresentation];
    else
        return [super preferredInterfaceOrientationForPresentation];
}

@end
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:252364次
    • 积分:5517
    • 等级:
    • 排名:第4780名
    • 原创:222篇
    • 转载:81篇
    • 译文:21篇
    • 评论:10条
    最新评论