Present a modal view controller with transparent background

Suppose, we’re in FirstViewController //Obj-C – (void) presentSecondVC { SecondViewController *vc = [[SecondViewController alloc] init]; [self addChildViewController:vc]; [self didMoveToParentViewController:vc]; } //Swift func presentSecondVC() { let vc = SecondViewController.init() self.addChildViewController(vc) self.didMove(toParentViewController: vc) } Some of you may need to write above method like this, //Obj-C – (void) presentSecondVC { SecondViewController *vc = [[SecondViewController alloc] init]; vc.view.frame … Read more

modal View controllers – how to display and dismiss

This line: [self dismissViewControllerAnimated:YES completion:nil]; isn’t sending a message to itself, it’s actually sending a message to its presenting VC, asking it to do the dismissing. When you present a VC, you create a relationship between the presenting VC and the presented one. So you should not destroy the presenting VC while it is presenting … Read more