ASMCropViewController 0.1

ASMCropViewController 0.1

测试测试过的
语言语言 Obj-CObjective C
许可 MIT
发布最新发布2014年12月

Andy Molloy 维护。




  • Andy Molloy

为 iOS 提供了另一个用于裁剪图像的 UI。与内置照片应用中的裁剪 UI 类似,但没有自动缩放的行为。

许可

MIT 许可协议。

安装

使用方法

ASMCropImageViewController* controller = [[ASMCropImageViewController alloc] init];
controller.image = [UIImage imageNamed:@"IMG_7999.jpg"];

UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentViewController:navController animated:YES completion:NULL];

默认情况下,裁剪框不受任何宽高比限制。您可以不通过任何方式更改这一点。

controller.aspectRatio = CGSizeMake(9, 16);

要回到不受限制的模式,只需将 aspectRatio 设置为零尺寸。

获取裁剪后的图像

UIImage* croppedImage = [controller croppedImage];

可以在视图呈现后随时调用此方法,并且可以频繁调用。

说明

此功能目前基本未经测试,并且尚未用于任何生产代码。请小心操作!