-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Muhammad Waqas edited this page Nov 24, 2015
·
1 revision
An Innovative Image Cropper made in Swift with which you can crop your profile pictures, background images according to your requirements.
- First Download the Example project from Github
- Drag the WBImageCropper into your project Swift project
- Conform to protocol pickedImageDelegate
- Add these line where you want to include WBImageCropper like this
Example:
Just create a view controller for image cropping and set the delegate.
let board:UIStoryboard = UIStoryboard.init(name:"Main", bundle:nil)
let imageVC:WBImageCropperVC = board.instantiateViewControllerWithIdentifier("WBImageCropperVC") as! WBImageCropperVC`
imageVC.tempFrame = frame // Frame of your cropping rectangle
imageVC.tempImage = image // Image you want to crop
imageVC.cornerRadius = radius // Corner radius If you want a circular cropping
imageVC.delegate = self // Delegate that you will implement
picker.pushViewController(imageVC, animated:true)
You have to implement two delegates
func didCancel(){
print("Cancel is Called")
}
func didDone(croppedImage:UIImage){
print("Your Cropped Image is ready here!")
}