JLImagePicker 0.1.3

JLImagePicker 0.1.3

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布日期最新发行版2019年8月

Joey Lee维护。



  • 作者:Joey Lee
  • Joey Lee

JLImagePicker

[Travis CI 状态](http://img.shields.io/travis/Joey%20Lee/JLImagePicker.svg?style=flat)](https://travis-ci.org/Joey%20Lee/JLImagePicker) 版本 许可协议 平台

示例

要运行示例项目,请克隆 repo,然后从 Example 目录运行 pod install

需求

安装

JLImagePicker 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中。

pod "JLImagePicker"

设置

在您的目标中 Info.plist 文件中添加隐私键字符串对。

  • 示例
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>

用法

  • Objective-C
#import <JLImagePicker/JLImagePicker.h>

[JLImagePicker takePhotoOnViewController:self.viewController
                                  camera:JLImagePickerCameraFront
                           allowsEditing:YES
                              completion:^(BOOL success, UIImage *image, AVAuthorizationStatus authStatus) {
                                  if(success) {
                                      // do something with the image
                                  }
                                  else {
                                      if(authStatus == AVAuthorizationStatusRestricted) {
                                          // alert
                                      }
                                      else if(authStatus == AVAuthorizationStatusDenied) {
                                          // alert + go to Settings app
                                      }
                                  }
                              }];
  • Swift 4
import JLImagePicker

JLImagePicker.takePhoto(on: viewController, camera: .front, allowsEditing: true) { (success, image, authStatus) in
    if success {
        // do something with the image
    }
    else {
        if authStatus == .restricted {
            // alert
        }
        else if authStatus == .denied {
            // alert + go to Settings app
        }
    }
}

作者

李志镨,[email protected]

许可证

JLImagePicker 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。