I'm working on an application and I want to take the instant screenshot of my screen. I read some tutorials about that, and found this sort of solutions :
UIImageView * Test = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
UIGraphicsBeginImageContext(CGSizeMake(320,480));
CGContextRef context = UIGraphicsGetCurrentContext();
[[self.view layer] renderInContext:context];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Test.image = screenShot;
[self.view addSubview:Test];
But this code doesn't give me the same thing as when on your device you push home and the other button to make a screenshot. How could i fix it please ?
EDIT : I have included QuartzCore/QuartzCore.h