任何人都能告诉我UIIMAGEPICKER如何裁剪图片,并将此裁剪图片保存在iphone目录中,以便在数据库中保存图像的路径并重新使用它?
答案 0 :(得分:1)
试试这个:
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info{
UIImage *img = [info objectForKey:UIImagePickerView.UIImagePickerControllerEditedImage];
//I think that's how you're supposed to get the image. Fiddle with it.
img.size = CGSizeMake(x, y);
img.scale = 0.75; //scale the image to 75 percent of it's original size.
UIImageWriteToSavedPhotosAlbum (*img, self, @selector(photoSaved), nil);
}
-(void)photoSaved image: (UIImage *) image
didFinishSavingWithError: (NSError *) error
contextInfo: (void *) contextInfo;{
if(!error){
NSLog(@"Photo saved to library!");
} else{
NSLog(@"Saving failed :(");
}
}