I'm running iOS 4.3 & trying to take a screenshot of a UIView which is playing a movie. The problem is that the screenshot (in the simulator) turns out to be simply a black background & not the movie image i was hoping for. My code is below, any ideas what the matter might be? thanks in advance :)
- (void) takeScreenshot; { UIGraphicsBeginImageContextWithOptions(self.frame.size, NO, 0.0); [self.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageView *movieImage = [[UIImageView alloc] initWithImage:screenshot]; [self addSubview:movieImage]; }
[self.layer renderInContext:UIGraphicsGetCurrentContext()];because you taking the screenshot of the self.layer instead of your movieplayer view.