I am taking the screen shot on .mm file i used the below code
I tried in 2 ways it is not working.. If i place the same code in any one of my .m file its working
- (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;
}
It is not works on .mm Is there any other option to do?
(I integrated openCv in my project there i used 1 .mm file)
Please Guide me
Thanks in advance
viewWillAppear method called before the view is rendered, so nothing to capture there. Have you tried using viewDidAppear instead?
Some reference.