首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何像在联系人中添加照片选项一样,实现编辑照片的移动缩放图片选项

如何像在联系人中添加照片选项一样,实现编辑照片的移动缩放图片选项
EN

Stack Overflow用户
提问于 2012-10-29 06:50:18
回答 1查看 564关注 0票数 0

在我的iPhone应用程序i中添加了照片选项,因为我添加了照片from library as well as captured images

当我打开图像选择器来添加/捕获图像时,它只显示retake & use照片。

当我点击“使用”时,它会显示为图像视图中的图像。

但是i need to display my selected crop,就像在iphone的联系人应用中添加照片一样

我通过设置self.imagePickerController.allowsEditing = YES;做了

但是,每当我想编辑图像时,我都需要返回原始图像,而不是图像选择器中的缩放/裁剪图像,以重新编辑

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-29 07:41:18

您必须将allowEditing of UIImagePickerController设置为“是”,请尝试以下操作:

代码语言:javascript
复制
- (IBAction)takePicture:(id)sender {
UIImagePickerController *imagePicer = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    [imagePicer setSourceType:UIImagePickerControllerSourceTypeCamera];
} else {
    [imagePicer setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}

// This will sets the editing mode after taking of picking image from image picker

[imagePicer setAllowsEditing:YES];
[imagePicer setDelegate:self];

//place image picker on the screen
[self presentViewController:imagePicer animated:YES completion:nil];
}

如果您想使用编辑后的图像,请将"UIImagePickerControllerOriginalImage“更改为"UIImagePickerControllerEditedImage",就这样!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13117078

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档