在iphone上进行图像编辑

时间:2010-11-08 04:28:15

标签: iphone image scale edit crop

在我的应用程序中,我需要从照片库中选择一个图像,然后用户应该能够裁剪或缩放图像。谁能帮帮我吗?

4 个答案:

答案 0 :(得分:1)

UIImagePickerController应该可以做到这一点。

UIImagePickerController *picker = [UIImagePickerController new];
picker.delegate = self;
picker.allowsEditing = YES;
[yourViewController presentModalViewController:picker];

然后我们需要实现委托方法:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
}

答案 1 :(得分:1)

您可以使用UIImagePickerController让用户从照片库中选择一张图片。

答案 2 :(得分:0)

@denizen 该 [yourViewController presentModalViewController:picker];需要动画:BOOL。

赞:[yourViewController presentModalViewController:picker animated:YES];

答案 3 :(得分:0)

您还可以查看SSPhotoCropperViewController。它是一个自定义视图控制器,提供简单,可配置且易于使用的UI,用于在iPhone和iPhone中裁剪和缩放照片。 iPod Touch应用程序。

为了从照片库中挑选照片,UIImagePickerController运行良好。但是你不能将它用于你从其他来源获得的照片,比如Flickr,FB等。

以下是SSPhotoCropperViewController的tutorialsource code on GitHub