Skip to content

vvbogdan/BVCropPhoto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

BVCropPhoto is image cropping library for iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published