横竖屏切换问题ios
来源:互联网 发布:如何用java制作表格 编辑:程序博客网 时间:2024/05/16 09:41
-(BOOL)shouldAutorotate{ return YES;}-(NSUInteger)supportedInterfaceOrientations{ return [self.viewControllers.lastObject supportedInterfaceOrientations];}-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ return [self.viewControllers.lastObject preferredInterfaceOrientationForPresentation];}在每个viewcontroller中写以下的代码支持横竖屏:
- (BOOL)shouldAutorotate{ return NO;/返回YES 支持旋转}- (NSUInteger)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskPortrait;/UIInterfaceOrientationMaskPortrait(支持竖屏) UIInterfaceOrientationMaskLandscapeLeft(支持home键向左)UIInterfaceOrientationMaskLandscapeRight (支持home键向右)UIInterfaceOrientationMaskPortraitUpsideDown (支持home键在上)UIInterfaceOrientationMaskLandscape(支持横屏)UIInterfaceOrientationMaskAll (支持各个方向)UIInterfaceOrientationMaskAllButUpsideDown(支持除了home键在上方的) }- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ return UIInterfaceOrientationPortrait;}
如果根视图为UITabBarController 在tabbar的子类写如下代码
- (BOOL)shouldAutorotate{ //返回顶层视图的设置(顶层控制器需要覆盖shouldAutorotate方法) NavRootViewController *nav = (NavRootViewController *)[self.viewControllers objectAtIndex:self.selectedIndex]; return nav.topViewController.shouldAutorotate; //}////return NO;}- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{ NavRootViewController *nav = [self.viewControllers objectAtIndex:self.selectedIndex]; return nav.topViewController.preferredInterfaceOrientationForPresentation;}//6.0之后系统调用该方法-(NSUInteger)supportedInterfaceOrientations{ //返回顶层视图支持的旋转方向 NavRootViewController *nav = (NavRootViewController *)[self.viewControllers objectAtIndex:self.selectedIndex]; return nav.topViewController.supportedInterfaceOrientations; // return 0; }
以下是参考文档
{
}
//6.0之后系统调用该方法
-(BOOL)shouldAutorotate
{
//系统会调用跟视图的旋转控制方法,所以我们将跟视图将控制条件交给顶层视图(顶层视图即我们需要控制的视图)
系统调用该方法
}
//6.0之后系统调用该方法,应该支持的方向
-(NSUInteger)supportedInterfaceOrient
{
}
三、跟视图为UITabBarController(在UITabBarController中设置)
//6.0之后系统调用该方法
-(BOOL)shouldAutorotate
{
}
//6.0之后系统调用该方法
-(NSUInteger)supportedInterfaceOrient
{
}
四、跟视图为MMDrawerController
//6.0一下系统调用该方法
-(BOOL)shouldAutorotateToInterf
{
}
//6.0之后系统调用该方法
-(BOOL)shouldAutorotate
{
}
//6.0之后系统调用该方法
-(NSUInteger)supportedInterfaceOrient
{
}
五、presentViewController视图控制
- 横竖屏切换问题ios
- iOS 屏幕横竖屏切换问题
- ios横竖屏切换
- IOS横竖屏切换
- IOS 横竖屏切换
- iOS横竖屏切换
- ios 切换横竖屏
- iOS 横竖屏切换
- iOS 横竖屏切换
- iOS横竖屏切换
- iOS 横竖屏切换
- 切换横竖屏问题
- 横竖屏切换问题
- 横竖屏切换问题
- iOS 6横竖屏切换
- iOS的横竖屏切换
- ios代码切换横竖屏
- IOS强制横竖屏切换
- jq图片左右无缝切换滚动,有定时切换。
- 浅谈Linux内存管理机制
- [译]Python:学习Python的艰难之路(3rd) 前言
- 关于学习angularjs的一个很好的笔记
- undefined symbol: __gxx_personality_v0解决办法
- 横竖屏切换问题ios
- JavaScript权威指南读书笔记 (二)
- akoj-1191-喜欢二的小胖
- 通过SQL进行远程访问
- java多态性override和overload的区别
- mac osx 执行shell脚本和在终端执行不一致
- js改变img标签的src属性在IE下没反应的解决方法
- 第11周项目--bool之の回文数,素数
- CString之间赋值出现错误