0
我正在拍摄.mm文件的屏幕截图我使用了下面的代码 我尝试了2种方式,它不工作..如果我把相同的代码放在任何一个我的.m文件的工作原理当拍摄屏幕截图.mm文件没有给出
- (void)viewWillAppear:(BOOL)animated
{
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
appDelegate.convertedImage=image;
UIGraphicsEndImageContext();
}
(or)
-(void)viewWillAppear:(BOOL)animated
{
CGSize newSize = CGSizeMake(320, 416);//377
UIGraphicsBeginImageContext(newSize);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
appDelegate.convertedImage=viewImage;
}
它不适用于.mm是否有其他选择吗? (我集成OpenCV的在我的项目有,我用1个.mm文件)
请指导我
在此先感谢
添加'[super viewWillAppear:animated];'也。你有没有尝试'viewDidAppear:'? – Ilanchezhian
好的..我试过..在这两种方法....但没有工作@Aadhira – Babul
什么是行不通的? –