Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 1.95 KB

README.md

File metadata and controls

67 lines (51 loc) · 1.95 KB

BVCropPhoto

BVCropPhoto is image cropping library for iOS.

System requirements

  • iOS 9.0 or higher

Installation

CocoaPods

pod 'BVCropPhoto'

Usage

BVCropPhotoView

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];

Get the cropped image

UIImage * croppedImage = self.cropPhotoView.croppedImage;

BVCropViewController

Init

    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"];

Get the cropped image

- (void)cropViewControllerDidCrop:(BVCropViewController *)sender croppedImage:(UIImage *)croppedImage{
    self.imageView.image = croppedImage;
}

License

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