CropPickerController 0.2.0

CropPickerController 0.2.0

Maintained by pikachu987, ‘pikachu987’.



  • By
  • pikachu987

CropPickerController

Version License Platform Swift 5.0

Introduce

There is a single image picker controller for cropping and a multi image picker controller for selecting various images. You can select an album and it will be updated automatically when you edit the album.

CropPickerView

If you want to customize your UIViewController or just display a Crop View, see CropPickerView


CropPickerController

Single Complex
Camera Progress

Requirements

CropPickerController written in Swift 5.0. Compatible with iOS 8.0+

Installation

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

pod 'CropPickerController'

Usage

image

import CropPickerController
let cropPickerController = CropPickerController(.single)
// let cropPickerController = CropPickerController(.complex)
cropPickerController.delegate = self
let navigationController = UINavigationController(rootViewController: cropPickerController)
present(navigationController, animated: true, completion: nil)

Init

CropPickerController(.single)
CropPickerController(.single, isCamera: true)
CropPickerController(.complex)
CropPickerController(.complex, isCamera: false)

Property

BarButtonItem

cropPickerController.leftBarButtonItem = UIBarButtonItem(title: "Back", style: .plain, target: cropPickerController, action: #selector(cropPickerController.backTap(_:)))
cropPickerController.rightBarButtonItem = UIBarButtonItem(title: "Crop", style: .done, target: cropPickerController, action: #selector(cropPickerController.cropTap(_:)))

color

cropPickerController.leftBarButtonItem?.tintColor = .black
cropPickerController.rightBarButtonItem?.tintColor = .black
cropPickerController.titleButton.setTitleColor(.black, for: .normal)

cropPickerController.cameraTintColor = .red
cropPickerController.cameraBackgroundColor = UIColor(white: 0.2, alpha: 1)

cropPickerController.pictureDimColor = UIColor(red: 242/255, green: 121/255, blue: 141/255, alpha: 0.5)

cropPickerController.selectBoxTintColor = .black
cropPickerController.selectBoxLayerColor = .gray
cropPickerController.selectBoxBackgroundColor = .gray

cropPickerController.progressTextColor = .black
cropPickerController.progressColor = .red
cropPickerController.progressTintColor = .blue
cropPickerController.progressBackgroundColor = .white

cropPickerController.cropLineColor = .blue
cropPickerController.imageBackgroundColor = .white
cropPickerController.scrollBackgroundColor = .white
cropPickerController.cropDimBackgroundColor = UIColor(white: 0, alpha: 0.9)

zoom

cropPickerController.scrollMinimumZoomScale = 0.1
cropPickerController.scrollMaximumZoomScale = 12

text

cropPickerController.permissionGalleryDeniedTitle = "Denied"
cropPickerController.permissionGalleryDeniedMessage = "Denied Gallery"
cropPickerController.permissionCameraDeniedTitle = "Denied"
cropPickerController.permissionCameraDeniedMessage = "Denied Camera"
cropPickerController.permissionActionMoveTitle = "Move~"
cropPickerController.permissionActionCancelTitle = "Cancel!"

Selector

Back and Crop

#selector(cropPickerController.backTap(_:))
#selector(cropPickerController.cropTap(_:))

Delegate

class ViewController: UIViewController{
    override func viewDidLoad() {
        super.viewDidLoad()

        let cropPickerController = CropPickerController(.single)
        cropPickerController.delegate = self
    }
}

// MARK: CropPickerDelegate
extension ViewController: CropPickerDelegate {
    func cropPickerBackAction(_ cropPickerController: CropPickerController) {

    }
    func cropPickerCompleteAction(_ cropPickerController: CropPickerController, images: [UIImage]?, error: Error?) {

    }
}

Author

pikachu987, [email protected]

License

CropPickerController is available under the MIT license. See the LICENSE file for more info.