【发布时间】:2011-04-23 23:24:04
【问题描述】:
我正在尝试合并两个 UIImageView。第一个 UIImageView (theimageView) 是背景,第二个 UIImageView (Birdie) 是覆盖第一个 UIImageView 的图像。您可以从地图加载第一个 UIImageView 或拍照。在此之后,您可以在第一个 UIImageView 上拖动、旋转和缩放第二个 UIImageView。我希望输出(保存的图像)看起来与我在屏幕上看到的一样。
我得到了它的工作,但我得到了边框,质量和尺寸都很糟糕。我希望尺寸与所选图像的尺寸相同,并且质量要好。如果我第二次保存它,我也会崩溃,就在第一次之后。
这是我当前的代码:
//save actual design in photo library
- (void)captureScreen {
UIImage *myImage = [self addImage:theImageView ToImage:Birdie];
[myImage retain];
UIImageWriteToSavedPhotosAlbum(myImage, self, @selector(imageSavedToPhotosAlbum:didFinishSavingWithError:contextInfo:), self);
}
- (UIImage*) addImage:(UIImage*)theimageView toImage:(UIImage*)Birdie{
CGSize size = CGSizeMake(theimageView.size.height, theimageView.size.width);
UIGraphicsBeginImageContext(size);
CGPoint pointImg1 = CGPointMake(0,0);
[theimageView drawAtPoint:pointImg1 ];
CGPoint pointImage2 = CGPointMake(0, 0);
[Birdie drawAtPoint:pointImage2 ];
UIImage* result = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return result;
}
但我只收到此代码的错误! 提前致谢!
【问题讨论】:
标签: iphone xcode merge uiimageview save