在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:kishikawakatsumi/PEPhotoCropEditor开源软件地址:https://github.com/kishikawakatsumi/PEPhotoCropEditor开源编程语言:Objective-C 97.8%开源软件介绍:PEPhotoCropEditorPEPhotoCropEditor is image cropping library for iOS, similar to the Photos.app UI. Features
System requirements
InstallationCocoaPods
UsageUse view controller component PECropViewController *controller = [[PECropViewController alloc] init];
controller.delegate = self;
controller.image = self.imageView.image;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentViewController:navigationController animated:YES completion:NULL]; Or use the crop view directly self.cropView = [[PECropView alloc] initWithFrame:contentView.bounds];
[self.view addSubview:self.cropView]; Get the cropped imagedelegate method - (void)cropViewController:(PECropViewController *)controller didFinishCroppingImage:(UIImage *)croppedImage
{
[controller dismissViewControllerAnimated:YES completion:NULL];
self.imageView.image = croppedImage;
} retrieve from view directly UIImage *croppedImage = self.cropView.croppedImage; Keep crop aspect ratio while resizingcontroller.keepingCropAspectRatio = YES; self.cropView.keepingCropAspectRatio = YES; Specify crop rect by image size based// e.g.) Cropping center square
CGFloat width = image.size.width;
CGFloat height = image.size.height;
CGFloat length = MIN(width, height);
controller.imageCropRect = CGRectMake((width - length) / 2,
(height - length) / 2,
length,
length); // e.g.) Cropping center square
CGFloat width = image.size.width;
CGFloat height = image.size.height;
CGFloat length = MIN(width, height);
self.cropView.imageCropRect = CGRectMake((width - length) / 2,
(height - length) / 2,
length,
length); Reset back crop rect to original image size and rotation[controller resetCropRect]; [self.cropView resetCropRect]; LicensePEPhotoCropEditor is available under the MIT license. See the LICENSE file for more info. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论