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中加入: ...
随机推荐
- no console to display at this time
no console to display at this time我把控制台关掉,重新run as 还是同样问题,于是运行其他项目,但是其他项目能正常运行,说明项目写的有问题,而不是控制台的问题
- Clion调试ROS包
1. 安装 从官网下载最新版本的Clion https://www.jetbrains.com/clion/ 并解压到指定的目录,例如: /home/xkc/software/clion-2017.2 ...
- python面向对象笔记
一.封装(属性/私有方法/公有方法/静态方法/构造函数...) # 定义一个类 class Animal: # 私有成员(用_开头的约定为私有成员 - 注:仅仅是君子协定) _age = 0 # 构造 ...
- How to change the implementation (detour) of an externally declared function
原文地址:http://stackoverflow.com/questions/6905287/how-to-change-the-implementation-detour-of-an-extern ...
- Android:ImageView控件
ImageView 是用于在界面上展示图片的一个控件,通过它可以让我们的程序界面变得更加 丰富多彩.学习这个控件需要提前准备好一些图片,由于目前 drawable 文件夹下已经有一张 ic_launc ...
- python测试开发django-47.xadmin上传图片和文件
前言 xadmin上传图片和上传文件功能 依赖环境 如果没安装Pillow的话,会有报错:practise.Upload.upload_image: (fields.E210) Cannot use ...
- GitHub超全机器学习工程师成长路线图,开源两日收获3700+Star!【转】
作者 | 琥珀 出品 | AI科技大本营(ID:rgznai100) 近日,一个在 GitHub 上开源即收获了 3700+ Star 的项目,引起了营长的注意.据介绍,该项目以 TensorFlow ...
- Android APK反编译详解(附图) (转)
这段时间在学Android应用开发,在想既然是用Java开发的应该很好反编译从而得到源代码吧,google了一下,确实很简单,以下是我的实践过程. 在此郑重声明,贴出来的目的不是为了去破解人家的软件, ...
- 使用SpringBoot配置了 server.servlet.path后无效的解决方案
一.问题描述 使用SpringBoot配置了 server.servlet.path后无效,访问时无法通过:http://127.0.0.1:8080/app/hello.html 访问. 二.解决方 ...
- [转]POJ3624 Charm Bracelet(典型01背包问题)
来源:https://www.cnblogs.com/jinglecjy/p/5674796.html 题目链接:http://bailian.openjudge.cn/practice/4131/ ...