2010-09-23 1 views

ответ

12

Как это (набранный из памяти, поэтому он не может быть 100% правильно):

// Get a UIImage from the view's contents 
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, view.contentScaleFactor); 
CGContextRef context = UIGraphicsGetCurrentContext(); 
[view.layer renderInContext:context]; 
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

// Convert UIImage to CGImage 
CGImageRef cgImage = image.CGImage; 
1

Также убедитесь, что вы добавляете

#import <QuartzCore/QuartzCore.h>

в код

+0

: P lol действительно? хаа –