我做的就像从画廊中获取图像一样。将其显示在另一个视图中。我可以裁剪该图像,但我无法保存。请有人帮我怎么做。
- (IBAction)cropClicked:(id)sender
{
[self.cropImgView crop];
}
- (void)JBCroppableImageView:(JBCroppableImageView *)controller didFinishCroppingImage:(UIImage *)croppedImage{
imag = croppedImage;
secondViewController *second=[[secondViewController alloc]initWithNibName:@"secondViewController" bundle:nil];
second.cutimage.image=croppedImage;
// [[self navigationController] pushViewController:second animated:YES];
// [self presentViewController:second animated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];
}
我点了这个链接http://code4app.net/ios/Croppable-View/50ecd42a6803fadd48000000
答案 0 :(得分:0)
To Save Crop image:
First of all add property cutimage in FirstViewController.h file
@interface FirstViewController
@property (nonatomic , strong) UIImageView *cutimage;
@end
also initialize it in viewdidload of FirstViewcontoller
cutimage = [[UIImageView alloc] init]
FirstViewController *objFirstViewController = [[FirstViewController alloc] init];
objFirstViewController.objFirstVC = self;
[self.navigationController pushViewController:objFirstViewController animated:NO] ;
1. Create a property in .h file within
@interface SecondViewController
@property (nonatomic, strong) FirstViewController *objFirstViewController
@end
2. now within JBCroppableImageView method
objFirstViewController.cutimage.image=croppedImage
now within FirstViewcontroller "cutimage" object could be accessed to show CroppedImage.
答案 1 :(得分:0)
如果您需要将图像保存到用户的相册,可以使用UIKit功能
void UIImageWriteToSavedPhotosAlbum ( UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo );