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;
    }
  • 相关阅读:
    解决maven无法下载jar的问题
    Vue-Router 基础
    VUE自定义组件
    VUE过滤器
    VUE生命周期函数
    VUE表单输入绑定
    VUE计算属性和监听器
    VUE 模板语法
    VUE介绍
    taro3.x: 函数组件createIntersectionObserver
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4366506.html
Copyright © 2011-2022 走看看