Latest 0.1.2
Homepage https://github.com/pikachu987/CropPickerView
License MIT
Platforms ios 8.0
Authors

Version
License
Platform
Swift 4.2

Introduce

The Corner and Side buttons allow you to modify the position of the crop and UIScrollView to zoom the image. If the image is larger than the area of the UIScrollView, the image can be scrolled up and down, left and right, and if the image is smaller than the area of the UIScrollView, the image is always centered.

CropPickerController

If you want to see the CropPickerViewController that is created with CropView, see CropPickerController

CropPickerView


Requirements

CropPickerView written in Swift 4.2. Compatible with iOS 8.0+

Installation

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

pod 'CropPickerView'

Usage

Xib or Storyboard file

setting

image

image

done!

Code editor

import CropPickerView
let cropPickerView = CropPickerView()
self.view.addSubview(cropPickerView)

done!

Property

image


cropPickerView.image = UIImage(named: "")

color


cropPickerView.cropLineColor = UIColor.gray
cropPickerView.scrollBackgroundColor = UIColor.gray
cropPickerView.imageBackgroundColor = UIColor.gray
cropPickerView.dimBackgroundColor = UIColor(white: 0, alpha: 0.1)

zoom


cropPickerView.scrollMinimumZoomScale = 1
cropPickerView.scrollMaximumZoomScale = 2

Method

crop


cropPickerView.crop { (error, image) in
    if let error = (error as NSError?) {
        let alertController = UIAlertController(title: "Error", message: error.domain, preferredStyle: .alert)
        alertController.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: nil))
        self.present(alertController, animated: true, completion: nil)
        return
    }
    self.imageView.image = image
}

Delegate


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

        let cropPickerView = CropPickerView()
        cropPickerView.delegate = self
    }
}

// MARK: CropPickerViewDelegate
extension ViewController: CropPickerViewDelegate {
    func cropPickerView(_ cropPickerView: CropPickerView, error: Error) {

    }
    func cropPickerView(_ cropPickerView: CropPickerView, image: UIImage) {

    }
}

Author

pikachu987, [email protected]

License

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

Latest podspec

{
    "name": "CropPickerView",
    "version": "0.1.2",
    "summary": "View with Crop screen",
    "description": "The Corner and Side buttons allow you to modify the position of the crop and UIScrollView to zoom the image. If the image is larger than the area of the UIScrollView, the image can be scrolled up and down, left and right, and if the image is smaller than the area of the UIScrollView, the image is always centered.",
    "homepage": "https://github.com/pikachu987/CropPickerView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "pikachu987": "[email protected]"
    },
    "source": {
        "git": "https://github.com/pikachu987/CropPickerView.git",
        "tag": "0.1.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "CropPickerView/Classes/**/*",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This