PhotoSolution 1.5.8

PhotoSolution 1.5.8

Mark Ma 维护。



  • 作者:
  • Mark Ma

PhotoSolution

PhotoSolution

特性

  • 自定义相机,包括放大、闪光灯、对焦功能,可切换前后摄像头。
  • 从本地照片库中挑选多张图片(您可以设定最大数量)
  • 同时支持 Objective-C 和 Swift
  • 浏览所有相册
  • 查看、缩放和在原始尺寸下编辑图片
  • 压缩图片
  • 自定义一些 UI 属性,如颜色和标题。
  • 支持 AutoLayout,适用于所有不同屏幕尺寸的纵向和横向。

安装

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

use_frameworks!

然后添加

pod 'PhotoSolution'

相关权限(您需要首先在 Info.plist 中添加它们)

  • 隐私 - 描述照片库使用说明
  • 隐私 - 照片库添加使用说明
  • 隐私 - 摄像头使用说明

基本使用

Objective-C

//import it
@import PhotoSolution;

//define delegate
@interface YourViewController () <PhotoSolutionDelegate>

//initilize
PhotoSolution* photoSolution = [[PhotoSolution alloc] init];
photoSolution.delegate = self;

//take photo
[self presentViewController: [photoSolution getCamera] animated:YES completion:nil];

//pick photos from local library and define maximum picking amount, like 9
[self presentViewController: [photoSolution getPhotoPickerWithMaxPhotos:9] animated:YES completion:nil];

//implement delegate method
-(void)returnImages:(NSArray *)images{
   // deal with the return images
}

-(void)pickerCancel{
   // when user cancel picking photo
}

Swift

//import it
import PhotoSolution

//initilize
let photoSolution = PhotoSolution()
photoSolution.delegate = self

//take photo
self.present(photoSolution.getCamera(), animated: true, completion: nil)

//pick photos from local library and define maximum picking amount, like 9
self.present(photoSolution.getPhotoPicker(maxPhotos: 9), animated: true, completion: nil)

//implement delegate method
extension YourViewController: PhotoSolutionDelegate{
func returnImages(_ images: [UIImage]) {
   // deal with the return images
}

func pickerCancel() {
    // when user cancel
}
}

自定义(可选)

Objective-C

photoSolution.customization.markerColor = [UIColor colorWithRed:0.14 green:0.72 blue:0.30 alpha:1.0];
photoSolution.customization.navigationBarBackgroundColor = UIColor.darkGrayColor;
photoSolution.customization.navigationBarTextColor = UIColor.whiteColor;
photoSolution.customization.titleForAlbum = @"Album";
photoSolution.customization.alertTextForPhotoAccess = @"Your App Would Like to Access Your Photos";
photoSolution.customization.settingButtonTextForPhotoAccess = @"Setting";
photoSolution.customization.cancelButtonTextForPhotoAccess = @"Cancel";
photoSolution.customization.alertTextForCameraAccess = @"Your App Would Like to Access Your Photos";
photoSolution.customization.settingButtonTextForCameraAccess = @"Setting";
photoSolution.customization.cancelButtonTextForCameraAccess = @"Cancel";
photoSolution.customization.returnImageSize = ReturnImageSizeCompressed;
photoSolution.customization.statusBarColor = StatusBarColorWhite;

Swift

photoSolution.customization.markerColor = UIColor(red:0.14, green:0.72, blue:0.30, alpha:1.0)
photoSolution.customization.navigationBarBackgroundColor = UIColor.darkGray
photoSolution.customization.navigationBarTextColor = UIColor.white
photoSolution.customization.titleForAlbum = "Album"
photoSolution.customization.alertTextForPhotoAccess = "Your App Would Like to Access Your Photos"
photoSolution.customization.settingButtonTextForPhotoAccess = "Setting"
photoSolution.customization.cancelButtonTextForPhotoAccess = "Cancel"
photoSolution.customization.alertTextForCameraAccess = "Your App Would Like to Access Your Photos"
photoSolution.customization.settingButtonTextForCameraAccess = "Setting"
photoSolution.customization.cancelButtonTextForCameraAccess = "Cancel"
photoSolution.customization.returnImageSize = .compressed
photoSolution.customization.statusBarColor = .white

作者

马行事,专注于移动应用解决方案的软件开发者,包括服务器端后端开发(RESTful API、数据库、AWS部署)以及客户端应用开发(iOS && Android)。

授权

MIT