2013-01-20 42 views
0

我只想分享一個UIView vie電子郵件,FB或任何用戶想要的屏幕截圖! 下面的代碼只需要的UIView的原來沒有inputed文本,也沒有改變圖像我的應用程序運行時,如何以編程方式獲得LIVE屏幕截圖?

CGRect rect = [mainView bounds]; 
    UIGraphicsBeginImageContextWithOptions(rect.size,YES,0.0f); 
    CGContextRef context = UIGraphicsGetCurrentContext(); 
    [mainView.layer renderInContext:context]; 
    UIImage *capturedImage = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 
+0

相關:http://stackoverflow.com/questions/3869692/iphone-flattening-a-uiimageview-and-subviews-to-image-blank-image/3869804#3869804 –

回答

0

你應該能夠取決於它是否是一個視網膜設備或不使用的解決方案之一,在this answer

相關問題