38

GitHub - Mark-Ma-1988/PhotoSolution: PhotoSolution is an all-in-one photo soluti...

 6 years ago
source link: https://github.com/Mark-Ma-1988/PhotoSolution
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

README.md

PhotoSolution

PhotoSolution

Version License Platform Swift

Features

  • Take photo
  • Pick multiple images (you can set maximum amount) from the local photo library
  • Support both Objective-C and Swift
  • Browse all the albums
  • View, expand and edit an image in its original size
  • Compress images
  • Comtomize some UI properties, like color and title.

Installation

PhotoSolution is available through CocoaPods. To install it, simply add the following line to your Podfile:

use_frameworks!

and then add:

pod 'PhotoSolution'

Related Permissions (Your need to add them in Info.plist firstly)

  • Privacy - Photo Library Usage Description
  • Privacy - Photo Library Additions Usage Description
  • Privacy - Camera Usage Description

Basic Usage

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
}
}

Customization (optional)

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

Author

Mark Ma, a software developer focused on mobile application solution, including server side backend development (restful API, database, AWS deployment) and client side app development (iOS && Android).

License

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK