UIInterfaceOrientation over iOS6 (应用旋转屏幕)
typedef NS_ENUM(NSInteger, UIInterfaceOrientation) {
UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
};
UIInterfaceOrientation enum
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskLandscape;
}
#import "TYSXTabBarController.h" #define kTabBarColor [UIColor colorWithRed:0.953f green:0.953f blue:0.953f alpha:1.00f]
#define kTintColor [UIColor colorWithRed:0.914f green:0.000f blue:0.294f alpha:1.00f] @implementation TYSXTabBarController - (void)viewDidLoad
{
[super viewDidLoad];
self.tabBar.translucent = NO;
[self.tabBar setBarTintColor:kTabBarColor];
self.tabBar.tintColor = kTintColor;
} - (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
} - (BOOL)shouldAutorotate
{
return YES;
} - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
@end
TabBarController.m
这样,TabBarController下的所有页面就都只能是竖向了。
如何让某个页面只能是横向的呢?
以全屏播放页面(FullScreenViewController)为例,Present显示该页面,如此,播放页面就与TabBarController独立开了,在FullScreenViewController.m中实现以下方法
@implementation FullScreenViewController - (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
} - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
} @end
FullScreenViewController.m
UIInterfaceOrientation over iOS6 (应用旋转屏幕)的更多相关文章
- Android 旋转屏幕--处理Activity与AsyncTask的最佳解决方案
一.概述 运行时变更就是设备在运行时发生变化(例如屏幕旋转.键盘可用性及语言).发生这些变化,Android会重启Activity,这时就需要保存activity的状态及与activity相关的任务, ...
- android手机旋转屏幕时让GridView的列数与列宽度自适应
无意中打开了一年前做过的一个android应用的代码,看到里面实现的一个小功能点(如题),现写篇文章做个笔记.当时面临的问题是,在旋转屏幕的时候需要让gridview的列数与宽度能自适应屏幕宽度,每个 ...
- Android——旋转屏幕导致Activity重建解决方法
Android开发文档上专门有一小节解释这个问题.简单来说,Activity是负责与用户交互的最主要机制,任何“设置”(Configuration)的改变都可能对Activity的界面造成影响,这时系 ...
- iOS两个强制旋转屏幕的方法
第一个: // 状态栏动画持续时间 CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimation ...
- Android开发 旋转屏幕导致Activity重建解决方法(转)
文章来源:http://www.jb51.net/article/31833.htm Android开发文档上专门有一小节解释这个问题.简单来说,Activity是负责与用户交互的最主要机制,任何“ ...
- Xamarin.Android 开发中遇到旋转屏幕错误
错误信息 : System.NotSupportedException: Unable to find the default constructor on type App5.MyFragment. ...
- Unity3D研究院之设置自动旋转屏幕默认旋转方向
如下图所示,在处理屏幕默认旋转方向的时候可以在这里进行选择,上下左右一共是4个方向. 策划的需求是游戏采用横屏,但是要求支持两个方向自动旋转,如下图所示,我的设置是这样的. Default Orien ...
- Android 最基础生命周期及旋转屏幕问题
public class MainActivity extends Activity { private static final String TAG ="MainActivity&quo ...
- Android 禁止屏幕旋转 & 旋转屏幕时保持Activity内容
Android 禁止屏幕旋转 & 旋转屏幕时保持Activity内容 1.在应用中固定屏幕方向. 在AndroidManifest.xml的activity中加入: ...
随机推荐
- [ Visual Studio ] MSDN
在 Visual Studio 中创建自定义项目和项模板 编写和重构代码 (C++) C# 指南 C#最新版本 使用 MSBuild 如何:管理编辑器模式,进入全屏模式编写代码 自定义代码折叠
- Qt 4.6.2静态编译
一.下载mingw 4.4.0:ftp://ftp.trolltech.com/misc/MinGW-gcc440_1.zip 二.解压到C:\mingw目录下,设置环境变量path将C:\mingw ...
- mongodb.mongoose维护内嵌数组元素
运行环境: - Nodejs - MongoDB 文档实例名: ProjectJob 文档格式如下: { "_id" : ObjectId("5bc69eb0b298b3 ...
- su 与 su - 比较
原文地址:http://blog.chinaunix.net/uid-25557346-id-2889329.html 今天有一同事说在切换用户的时候,找不到该用户下用户命令,后来仔细检查了一下过 ...
- 关于Java变量的可见性问题
转自:http://www.importnew.com/19434.html 博文前提 最近在oschina问答板块看到了一个关于java变量在工作内存和主存中的可见性问题:synchorized,s ...
- jstl 格式化
一:JSTL格式化标签又称为I18N标签库,主要用来编写国际化的WEB应用,使用此功能可以对一个特定的语言请求做出合适的处理.例如:中国内地用户将显示简体中文,台湾地区则显示繁体中文,使用I18N格式 ...
- angularjs drag and drop
angular-dragula Drag and drop so simple it hurts 480 live demo angular-drag-and-drop-lists Angular d ...
- QueryRunner实战(query_update)、BeanList\BeanHandler、MapList\MapHandler、ScalarHandler
1.c3p0-config.xml <?xml version="1.0" encoding="UTF-8"?> <c3p0-config&g ...
- jquery ajax IE
在ie上会出现,get/post 只调用一次的现象 解决方法: cache:false http://stackoverflow.com/questions/8841425/how-to-set-ca ...
- 2017 33 款iOS开源库
IGListKit https://github.com/Instagram/IGListKit 由 Instagram 开发人员制作,IGListKit 是用于构建快速灵活列表的数据驱动型的 UIC ...