zoukankan      html  css  js  c++  java
  • iOS8中UIActionSheet弹出UIImagePickerController异常处理

    iOS8之后,UIActionSheet改父于UIAlertController。带来了一丢丢兼容性的问题。

    比如在弹出的actionsheet中选择从相册选择图片或者拍照,之后弹出UIImagePickerController进行选择。

    在iOS8以前的方法里,直接在

    -(void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;
    

    Click的委托事件里处理就好了,但是在iOS8,系统会抛出警告

    Warning: Attempt to present <UIImagePickerController: 0x292b400>  on <**Controller: 0x723c150> which is already presenting <UIAlertController: 0xd37b8b0>
    

    并且取消弹出ImagePicker行为。

    原因在警告里说得比较明白了,因为已经有actionsheet存在了,不能present新的。此时我们选择新的委托方法

    - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex;
    

    didDismissWithButtonIndex方法即可。

  • 相关阅读:
    R.drawable 转 bitmap
    opengl
    android 时间1
    mysql 管理工具
    使用BroadcastReceiver实现开机启动Service或Activity
    webView
    博客收藏1
    popupWindow 弹出菜单
    viewpager android viewGroup左右滑动方法1
    Android中Bitmap和Drawable
  • 原文地址:https://www.cnblogs.com/anjohnlv/p/4077901.html
Copyright © 2011-2022 走看看