博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UITabBarControler解决旋转问题
阅读量:6933 次
发布时间:2019-06-27

本文共 739 字,大约阅读时间需要 2 分钟。

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

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

你可能感兴趣的文章
document.body.scrollTop or document.documentElement.scrollTop
查看>>
使用Maven创建一个Spring MVC Web 项目
查看>>
使用Redis模拟简单分布式锁,解决单点故障的问题
查看>>
[笔记]linux磁盘管理
查看>>
error C2065: 'theApp' : undeclared identifier
查看>>
linux中的颜色控制
查看>>
[SOJ #48]集合对称差卷积
查看>>
[bzoj3156]防御准备
查看>>
POJ-2792-集合加法
查看>>
验证的概述
查看>>
关于网页安全输出隐藏
查看>>
javascript内存泄漏
查看>>
Maya批量传递UV插件
查看>>
windows 地址空间分配
查看>>
install Maven
查看>>
android Thread和Service的区别
查看>>
前端交流会
查看>>
ASP.NET Boilerplate 邮件类使用
查看>>
C++实现快速排序
查看>>
C# 把一个文件夹下所有文件删除
查看>>