繁体   English   中英

如何推送具有透明背景的新viewController?

[英]How to push a new viewController with Transparent Background?

我想在已经显示的一个View Controller的顶部推送具有透明背景的新视图控制器。 我知道如何呈现,但我想推动新的View Controller。

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

您需要为ViewController提供内存并设置为UINavigationController的 RootController 之后,您可以从当前控制器推送它...

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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