2012-01-19 70 views

回答

2
UIView *view = ...; // Get root view of current view controller 

UIGraphicsBeginImageContext(view.bounds.size); 
[view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 

NSData *imageData = UIImagePNGRepresentation(viewImage);