0
我用背景相機控制器拍攝了覆蓋圖像的屏幕截圖。但拍照拍攝屏幕截圖時,相機控制器不工作
代碼時背景cameracontroller層是躲在:
CGRect rect = [previewView bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[previewView.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
有沒有什麼辦法可以用cameralayer拍攝UIImage。我搜索了很多教程。幫助我.. – Ram 2013-03-27 05:24:21
不幸的是,沒有我知道的一個簡單的方法。前一段時間它被接受使用特殊函數UIGetScreenImage(),但是是一個私有API,如果你正在構建AppStore,很可能你會得到一個拒絕。我建議你閱讀這個SO回答http://stackoverflow.com/questions/2200736/how-to-take-a-screenshot-programmatically和蘋果的這個技術說明,你會發現它非常有幫助http://developer.apple .COM /庫/ IOS/ipad公司/#QA/qa1714/_index.html – Andrea 2013-03-27 05:45:06