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  阅读(257)  评论(0编辑  收藏  举报