简体   繁体   中英

How to push a new viewController with Transparent Background?

I wanted to Push New View Controller with Transparent Background on top of one View Controller which is already shown. I know How to PRESENT but I wanted to PUSH new View Controller.

UIViewController *controller = [[UIViewController alloc] init];
self.definesPresentationContext = YES;
controller.modalPresentationStyle = UIModalPresentationOverCurrentContext;
[self presentViewController:controller animated:YES completion:^{}];

You need to give memory to your ViewController and set to RootController of UINavigationController . After that, you can push it from your current controller...

UIViewController *yourViewController = [[UIViewController alloc] init];
UINavigationController *navigationController1 = [[UINavigationController alloc] initWithRootViewController:yourViewController];
[self presentViewController:navigationController1 animated:YES completion:nil];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM