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;
    }
  • 相关阅读:
    第九周学习进度
    用户场景描述
    第九天
    第10天
    求两个有序数组的中值
    计算字符串中最长子字符串的长度
    计算两个数之和
    将string 转int
    判断一个int 型整数 是否为回文数
    php 对象的一些特性
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4366506.html
Copyright © 2011-2022 走看看