ios - Objective-C 通过绘图裁剪图像

标签 ios objective-c drawing crop

我是 iOS 新手。我想通过从用户那里绘制来裁剪图像。我在谷歌上搜索了一天,但没有得到结果。 谢谢您的回答。

最佳答案

试试这段代码

  UIImagePickerController *picker=[[UIImagePickerController alloc] init];
    picker.delegate = self;
    [picker setAllowsEditing:YES];
    picker.sourceType=UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:picker animated:YES completion:nil];

然后你可以从

中获取裁剪图像
  - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
 {
  UIImage *image = [info valueForKey:UIImagePickerControllerEditedImage];
 picker dismissViewControllerAnimated:YES completion:^{}];

}

关于ios - Objective-C 通过绘图裁剪图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32499876/

相关文章:

ios - 如何根据设备文本大小更改标签大小 - Swift 3?

objective-c - 不同的 int 值还是相同的? NSLog 的 EXC_BAD_ACCESS

ios - 如何删除 UIBezierPath 绘图?

ios - 错误 : Bundle only contains bitcode-marker

更改 View 时 iOS 应用程序崩溃

javascript - 修改后将 Canvas 重置为之前的图片

c# - 捕获鼠标移动并导出为图像 [code |应用程序]

iOS UI 旋转器在处理后台线程时卡住

ios - 当我从详细 View 返回时图像数组加倍

ios - IOS NSDateFormatter问题