iOS 单独设置某个控制器横屏 —— HERO博客
来源:互联网 发布:mysql中full join报错 编辑:程序博客网 时间:2024/05/29 05:56
iOS程序开发中,若要单独让某个控制器横屏,可以用如下方法:
- 在 AppDelegate.h 添加属性:
//屏幕方向@property (nonatomic, assign) NSInteger allowRotation;
- 在 AppDelegate.m 添加方法:
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ if (_allowRotation == 1) { return UIInterfaceOrientationMaskLandscapeRight; }else { return UIInterfaceOrientationMaskPortrait; }}
- 可以在跳转控制器中设置:
HWGoalVC *vc = [[HWGoalVC alloc] init];[self.navigationController presentViewController:vc animated:YES completion:nil];
- 在目标控制器中设置:
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;appDelegate.allowRotation = 1;
- 在目标控制器返回时设置:
- (void)back{ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; appDelegate.allowRotation = 0; [self dismissViewControllerAnimated:YES completion:nil];}
- 若想隐藏StatusBar,可调用如下方法:
- (BOOL)prefersStatusBarHidden{ //iOS7前隐藏StatusBar [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade]; //iOS7以后隐藏StatusBar return YES;}
4 0
- iOS 单独设置某个控制器横屏 —— HERO博客
- iOS 控制器多次present后返回根控制器 —— HERO博客
- iOS 锁屏音频播放控制及音频信息设置 —— HERO博客
- iOS 计算某个日期一定天数后的新日期 —— HERO博客
- iOS UIScrollView简介 —— HERO博客
- iOS UICollectionView简介 —— HERO博客
- iOS UITextField简介 —— HERO博客
- iOS UIDynamic简介 —— HERO博客
- iOS 添加字体库 —— HERO博客
- iOS MD5加密 —— HERO博客
- iOS UITableView简介 —— HERO博客
- iOS 预产期计算器 —— HERO博客
- iOS UISearchBar简介 —— HERO博客
- iOS UISearchBar使用 —— HERO博客
- iOS 自定义日历 —— HERO博客
- iOS 自定义键盘 —— HERO博客
- iOS 图片压缩 —— HERO博客
- iOS 程序图标AppIcon和启动页面LaunchImage设置 —— HERO博客
- LeetCode--evaluate-reverse-polish-notation
- TCP中的多线程
- jQuery选择器及jQuery事件
- catch that cow
- Java中异常的基本应用(一)
- iOS 单独设置某个控制器横屏 —— HERO博客
- 最小生成树之Prim算法 优先队列版本
- Android 刷新UI界面,线程间通讯方法总结,Android 自学之路
- 使用facl和mount实现某用户对某个目录的访问控制
- Windows下使用winpcap-2.1ARP探测局域网活动主机(发送ARP请求)
- ReactJS学习笔记(四)-条件判断的几种形式
- 如何判断一个数字能否同时被两个数整除;
- SpringMVC-2016-04-06
- Xcode 7智能测试化工具XCTestCase学习