首页 > 其他 > 详细

UITabBarControler解决旋转问题

时间:2015-06-04 17:04:00      阅读:151      评论:0      收藏:0      [点我收藏+]


在一次开发项目中遇到了播放视频,播放完视频回到列表,该列表在 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

UITabBarControler解决旋转问题

原文:http://blog.csdn.net/capacity_bo/article/details/46363965

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!