0
截圖我一直的形象圖就拿剛的形象圖
@property (strong, nonatomic) IBOutlet UIImageView *imageView;
我想截圖。我有的代碼是整個屏幕。我已經看過這裏的其他答案,仍然無法解決,因爲我不想指定一個尺寸,我只需要整個圖像視圖作爲屏幕截圖。
- (UIImage*)captureView:(UIView *)view
{
CGRect rect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[view.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
它仍然採取整個屏幕不只是圖像視圖。 – Enquinn
它爲我工作。可能你做錯了什麼,或者無法正確解釋你的問題。 – iMuzahid