2012-02-14 67 views
0

我正在創建一個應用程序,在UIView子類中,我有幾個UIImageView控制着用戶選擇的UIImage。我希望能夠允許用戶將UIView保存到PhotoLibrary中,以便這些UIImageView被保存爲UIView中的某種拼貼。我是否需要用UIImageView代替UIView以允許代碼保存整個區域?或者我能否使用UIView將UIView保存到iPad PhotoLibrary

預先感謝您!

回答

1

此功能你想要做什麼,除了存儲:

-(UIImage *)takeScreeShotOfView:(UIView *)view 
{ 
    UIGraphicsBeginImageContext(CGSizeMake(1024, 748)); 
    CGContextRef context = UIGraphicsGetCurrentContext(); 
    [view.layer renderInContext:context]; 
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 
    return img; 
} 
+0

好,謝謝,這是一個出發點,這是有點什麼,我一直在尋找,感謝您的幫助! – Ollie177 2012-02-16 13:22:00