I want to use airplay or an HDMI adapter to demonstrate my iOS apps on a big screen.
The problem is that my app only runs in portrait mode and most TVs are in 16:9 aspect ratio and therefore the iPhone screen is very small. To fix this i want to rotate the TV and rotate the output of the iPhone to have a bigger display.
In iOS6 I used CADisplayLink and took a snapshot of the current screen and then drew it on the external screen. Unfortunately the old code didn't work anymore on iOS 7 and was kind of laggy. Is there a good framework for this?
If you don't have any framework suggestions, you could maybe help me make this more efficient?
My code currently looks like this:
- (UIImage *) screenshot {
UIView* view = [[UIScreen mainScreen] snapshotViewAfterScreenUpdates:YES];
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [UIScreen mainScreen].scale);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
- (void)drawFrame
{
UIImageView* contentView = (UIImageView *)[self.secondWindow.rootViewController.view viewWithTag:[@"contentView" hash]];
CGImageRef screenImg = [self screenshot].CGImage;//UIGetScreenImage();
contentView.image = [UIImage imageWithCGImage:screenImg scale:1.0 orientation:UIImageOrientationLeft];
}