我正在尝试合并两个UIImageViews。第一个UIImageView (theimageView)是背景,第二个UIImageView (Birdie)是覆盖第一个UIImageView的图像。您可以从地图加载第一个UIImageView或拍摄照片。之后,您可以在第一个UIImageView上拖动、旋转和缩放第二个and。我希望输出(保存的图像)看起来与我在屏幕上看到的一样。
我得到了它的工作,但我得到的边界和质量和大小是糟糕的。我想要的大小与所选择的图像相同,并且质量要好。另外,如果我在第一次之后再次保存它,我也会崩溃。
下面是我当前的代码:
//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;
}但是我只得到了这段代码的错误!在进阶时谢谢!
发布于 2011-04-24 10:59:59
https://stackoverflow.com/questions/5767632
复制相似问题