我有uiview,我想將該視圖轉換爲工作得很好的圖像,但是當我按下iphone的主頁按鈕並再次運行應用程序時,圖像變得放大。這裏是我將代碼轉換爲圖像的代碼。爲什麼在將視圖轉換爲圖像時圖像變焦?
- (UIImage *)captureView {
CGRect rect = [myview bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[myview.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
checkImage.image = [self captureView];
myView是主視圖的另一種視圖 –
是的,我知道但我只是想檢查,如果你在所有的代碼中使用self.view而不是myView,那麼它會得到整個視圖的圖像或不是..做到這一點,讓我知道,也使用我的代碼,而不是你從這個鏈接http:///stackoverflow.com/questions/14049796/howe-to-capture-uiview-top-uiview/ –
@parash喬希同樣的問題 –