如果项目中用了navigationViewController, 那么就应该新建一个uinavigationViewController的子类,然后在这个类里面写上下面的代码,在使用的时候就用自定义的这个navCtr, 就是说需要在根视图里面控制

  1. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
  2. {
  3. return toInterfaceOrientation != UIDeviceOrientationPortraitUpsideDown;
  4. }
  5. - (BOOL)shouldAutorotate
  6. {
  7. if ([self.topViewController isKindOfClass:[AddMovieViewController class]]) { // 如果是这个 vc 则支持自动旋转
  8. return YES;
  9. }
  10. return NO;
  11. }
  12. - (NSUInteger)supportedInterfaceOrientations
  13. {
  14. return UIInterfaceOrientationMaskAllButUpsideDown;
  15. }

单个ViewController支持横屏,其他全竖屏方法-b的更多相关文章

  1. iOS的横屏(Landscape)与竖屏(Portrait)InterfaceOrientation

    http://www.molotang.com/articles/1530.html 接着上篇写的触摸事件,这次借机会整理下iOS横屏和竖屏的翻转方向支持,即InterfaceOrientation相 ...

  2. Android开发中如何强制横屏和强制竖屏设置

    Android开发中如何强制横屏和强制竖屏设置 强制横屏设置: 按照下面代码示例修改Activity的onResume方法 @Override protected void onResume() { ...

  3. iOS强制横屏或强制竖屏

    原文链接 https://www.jianshu.com/p/d6cb54d2eaa1 亲测第二种我这边是阔以滴 第一种解决方案(不推荐,直接跳过看第二种解决方案): //强制转屏 - (void)i ...

  4. 二维码识别项目zxing横屏改为竖屏

    第1步: 在AndroidManifest中将CaptureActivity的screenOrientation属性做如下修改: android:screenOrientation="por ...

  5. js判断手机浏览器是横屏or竖屏

    移动端的浏览器一般都支持window.orientation这个参数,通过这个参数可以判断出手机是处在横屏还是竖屏状态. 从而根据实际需求而执行相应的程序.通过添加监听事件onorientationc ...

  6. 使用JavaScript判断手机是处于横屏还是竖屏

    移动端的浏览器一般都支持window.orientation这个参数,通过这个参数可以判断出手机是处在横屏还是竖屏状态.从而根据实际需求而执行相应的程序.通过添加监听事件onorientationch ...

  7. Android开发 设备横屏与竖屏的详解

    需要了解横竖屏切换关键知识 1.在Android设备的横竖屏幕,每一次切换横竖屏其实是在重新创建Activity,Activity会重新走一遍生命周期.从onCreate 到 onDestroy 2. ...

  8. 基于jQuery的判断iPad、iPhone、Android是横屏还是竖屏

    function orient() {if (window.orientation == 90 || window.orientation == -90) {//ipad.iphone竖屏:Andri ...

  9. JQuery 判断IPad、IPhone、Android是横屏还是竖屏(Window.Orientation实现)

    在ipad.iphone网页开发中,我们很可能需要判断是横屏或者竖屏.下面就来介绍如何用 jQuery 判断iPad.iPhone.Android是横屏还是竖屏的方法. 代码如下: function ...

随机推荐

  1. C#-Mdi多文档窗体及其子窗体的排列 ---ShinePans

    MdiLayout枚举成员及说明 Casecade s全部Mdi层叠在父窗体 TileHorizontal 水平平铺 TitleVertical 垂直平铺 Form1.cs (mdi) using S ...

  2. iozone文件系统测试 与EXCEL 制图

    http://www.iozone.org/[root@monitor bin]# ./iozone -a -s 512m -f /usr/test -y -q -Rb /root. -i -i Io ...

  3. iOS-CGContextRef画各种图形例子

    iOS-CGContextRef画各种图形例子 绘制效果图 绘制代码 - (void)drawRect:(CGRect)rect { //一个不透明类型的Quartz 2D绘画环境,相当于一个画布,你 ...

  4. (tomcat访问不了的两种解决方法)Bad Request(Invalid Hostname)

    显示这个页面的时候一般有几中解决方法: 第一种就是如下图所示的方法: 具体步骤是: 1.也就是左下角win的“运行”中输入cmd进入doc窗口中 2.输入代码:netstat -ano 3.找到占用8 ...

  5. 控件AutoCompleteTextView实现动态匹配输入内容的一种输入框

    <AutoCompleteTextView android:layout_width="match_parent" android:layout_height="w ...

  6. Android 安全性和权限

    自定义权限 permission <permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT& ...

  7. jQuery实现页面元素智能定位

    实现过程 Js侦听滚动事件,当页面滚动的距离(页面滚动的高度)超出了对象(要滚动的层)距离页面顶部的高度,即要滚动的层到达了浏览器窗口上边缘时,立即将对象定位属性position值改成fixed(固定 ...

  8. Syntax error on token "package", assert expected------踩坑记录

    今天写程序碰到个坑,eclipse编辑,jdk1.7,clean编译项目后报错Syntax error on token "package", assert expected 反复 ...

  9. hdoj 2047 简单递推

    代码: #include <stdio.h>int main(){ int n,m,i; __int64 x[41]; x[1]=3; x[2]=8; for(i=3;i<=40;i ...

  10. POJ3285 River Hopscotch(最大化最小值之二分查找)

    POJ3285 River Hopscotch 此题是大白P142页(即POJ2456)的一个变形题,典型的最大化最小值问题. C(x)表示要求的最小距离为X时,此时需要删除的石子.二分枚举X,直到找 ...