2011-01-24 53 views

回答

3
UIGraphicsBeginImageContext(view.bounds.size);  
[view.layer renderInContext:UIGraphicsGetCurrentContext()]; 
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 
NSData *imagedata = UIImagePNGRepresentation(viewimage); 
NSString *encodedString = [imageData base64Encoding]; 

其中視圖是繪製線條的視圖。

相關問題