UITabBarControler解决旋转问题


在遇到开发项目中播放视频,播放视频回列表后,,列表 NavigationController 里边, NavigationController 在 UItabBarController 里边,不要旋转禁止的操作,我尝试了很多办法,于 UIViewController 写禁止旋转的方法,在 navigaitonController 类别里面写,都没有非常好地饿解决该旋转的方法,都没有解决该问题.

后来自己定义了 UITabBarController的类别才算攻克了该旋转的问题, 


#import <UIKit/UIKit.h>


@interface UITabBarController (TabBarRotation)


- (BOOL)shouldAutorotate;


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation;


@end


#import "UITabBarController+Rotation.h"


@implementation UITabBarController (TabBarRotation)


- (BOOL)shouldAutorotate {


    return YES;


}


- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {

    return UIInterfaceOrientationPortrait;

}


@end



上面的一个类别能够解决 UITabBarController问题就出来了里面的旋转,


bo

版权声明:本文博主原创文章。博客,未经同意不得转载。

posted @ 2015-09-14 12:13  mengfanrong  阅读(265)  评论(0)    收藏  举报
众安尊享e升2025版 - 底部横幅广告
尊享e升 2025版
🚀 全新升级
百万医疗险全面升级 守护健康人生
✓ 一般医疗300万
✓ 重疾600万
✓ 6年保证续保
✓ 1万免赔额
600万
最高保障
首月特惠价
低至1元起
🛡️ 立即投保