UITabBarController旋转问题
来源:互联网 发布:stm8l编程手册 编辑:程序博客网 时间:2024/05/16 06:17
这个问题网上一下就能找到解决办法。
原文的连接地址:http://blog.csdn.net/studyrecord/article/details/6525441
1、默认的UITabBarController不支持四个方向,但可以给UITabBarController增加一个类别,实现旋转;具体做法:
在工程添加一个.h和.m文件如下:
//Rotation.h
#import <Foundation/Foundation.h>
@interface UITabBarController(Rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end
#import "Rotation.h"
@implementation UITabBarController(Rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
@end
重新编译,运行后UITabBarController就可以支持四个方向了;
2、进一步,如果UITabBarController包含多个ViewController,如A,B,C三个;但我们只想A,B,支持四个方向,而C只支持一个方向,则在
//Rotation.m
#import "Rotation.h"
@implementation UITabBarController(Rotation)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if([[self selectedViewController] isKindOfClass:[C class]]){
return NO;
}
return YES;
}
@end
- UITabBarController旋转问题
- UINavigationController、UITabBarController 支持屏幕自动旋转问题
- ios6.0 UINavigationController、UITabBarController 支持屏幕自动旋转问题
- iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- IOS iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- UITabbarcontroller里的viewcontroller旋转控制
- 继承UINavigationController的问题----UITabBarController
- UINavigationController+UITabBarController+内容遮挡问题
- 设置UITabBarController的图片问题
- UITabbarController
- UITabBarController
- UITabBarController
- UITabBarController
- LNK2005 LNK1169 Error and LNK4098 Warning
- (转) c#中如何设计一个窗体关闭,另一个窗体打开?
- UnixSocketV1Chap6selectpollepoll
- 取字符长度
- VS 2008 快捷键
- UITabBarController旋转问题
- GPIO的上拉下拉功能说明
- 实现可编辑表格
- 《深入理解计算机系统》(第二版)第二章练习题3
- vim 应用笔记,陆续添加中
- Flex 图片调整(Matrix 矩阵)(放大/放小/左旋转/右旋转/上移/下移/左移/右移/还原/调整 ...
- C# BP神经网络 类与实例
- 利用ACE日志策略进行日志运行时配置管理
- net user 用户名 密码 /add 建立用户