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();
相關:http://stackoverflow.com/questions/3869692/iphone-flattening-a-uiimageview-and-subviews-to-image-blank-image/3869804#3869804 –