BVCropPhoto is image cropping library for iOS.
- iOS 9.0 or higher
CocoaPods
pod 'BVCropPhoto'
Using with image overlay
self.cropPhotoView = [[BVCropPhotoView alloc] init];
self.cropPhotoView.overlayImage = [UIImage imageNamed:@"crop-overlay-568h"];
self.cropPhotoView.sourceImage = [UIImage imageNamed:@"example1.jpg"];
self.cropPhotoView.cropSize = CGSizeMake(260, 286);
Using with custom overlay view
self.cropPhotoView = [[BVCropPhotoView alloc] init];
self.cropPhotoView.sourceImage = [UIImage imageNamed:@"example1.jpg"];
self.cropPhotoView.cropSize = CGSizeMake(260, 286);
BVCropPhotoOverlayView * overlay = [[BVCropPhotoOverlayView alloc] initWithCropSize:self.cropPhotoView.cropSize];
[self.cropPhotoView updateOverlayView:overlay];
UIImage * croppedImage = self.cropPhotoView.croppedImage;
BVCropViewController *controller = [[BVCropViewController alloc] init];
controller.cropSize = CGSizeMake(260, 286);
controller.cropPhotoView.maximumZoomScale = 10;
[controller.cropPhotoView updateOverlayView:[[BVCropPhotoOverlayView alloc] initWithCropSize:CGSizeMake(260, 286)]];
controller.delegate = self;
controller.sourceImage = [UIImage imageNamed:@"example1.jpg"];
- (void)cropViewControllerDidCrop:(BVCropViewController *)sender croppedImage:(UIImage *)croppedImage{
self.imageView.image = croppedImage;
}
BVCropPhoto is available under the MIT license. See the LICENSE file for more info.