public

A way to show a transparent modal view controller. It's not really transparent, the modal just uses a screenshot as its background.

  • Download Gist
TransparentModalViewController.m
Objective-C
1 2 3 4 5 6 7 8 9 10 11
- (void)showCard:(id)sender
{
UIGraphicsBeginImageContext(self.view.window.frame.size);
[self.view.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIViewControllerSubclass *card = [[UIViewControllerSubclass alloc] init];
card.background = screenshot;
[self presentModalViewController:card animated:NO];
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.