zoukankan      html  css  js  c++  java
  • IOS 横屏中添加UIImagePickerController获取系统图片

    今天写ipad的项目,然后需要调用系统相册选择图片,然后用了UIImagePickerController ,崩溃了,后来查了一下,UIImagePickerController只支持竖屏,但是。。。

    我竟然找到了一个解决的方法:

    这是因为 UIImagePickerController只支持竖屏的原因。
    解决:
    
    1、在AppDelegate.m中添加
    
    
    ?
    1
    2
    3
    4
    5
    #if __IPAD_OS_VERSION_MAX_ALLOWED >= __IPAD_6_0
    - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
         return UIInterfaceOrientationMaskAll;
    }
    #endif
    这样一般的就解决问题了,再不行话继续
    在该viewController和上一层的viewController中添加
    
    
    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
        return (interfaceOrientation ==  UIInterfaceOrientationLandscapeLeft || interfaceOrientation ==  UIInterfaceOrientationLandscapeRight );
    }
     
    -(NSUInteger)supportedInterfaceOrientations {
        return UIInterfaceOrientationMaskLandscape;
    }
     
    - (BOOL)shouldAutorotate {
        return YES;
    }
  • 相关阅读:
    学生数据增删改查--顺序表
    应用3+2mvc第一次作业
    双色球随机选【代码】
    字符串穷举
    使用nuget发布自己的包
    VS CODE中配置JAVA格式化细节
    反射的理解(含一点xml)
    UdpClient实现udp消息收发
    c#背包问题代码
    利用TcpClient,简单的tcp消息收发
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4366506.html
Copyright © 2011-2022 走看看