簡體   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