簡體   English   中英

呈現模態UINavigationController

[英]Present a modal UINavigationController

在我的應用程序委托中,我這樣做:

navigationController = [[[UINavigationController alloc] initWithRootViewController:homePageController] autorelease];
[tabBarController presentModalViewController:navigationController animated:YES];

目前,它是一個模態UINavigationController。 但是在homePageController中,如何在該導航控制器中推送其他視圖?

我應該在homePageController的方法中調用嗎?

MyDelegate *delegate = (MyDelegate *) [[UIApplication sharedApplication] delegate];
[delegate.navigationController pushViewController:newView animation:YES];

還是應該使用其他方式?

您可以通過navigationController屬性訪問任何UIViewController的父級導航控制器。 因此,在您的HomePageController方法中:

[self.navigationController pushViewController:someViewController animated:YES];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM