2011-04-23 70 views
0

我想合併兩個UIImageViews。第一個UIImageView(theimageView)是背景,第二個UIImageView(小鳥)是覆蓋第一個UIImageView的圖像。您可以從地圖加載第一個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; 
} 

但我只用這個代碼得到錯誤! 感謝先進!

回答