簡體   English   中英

單獨使用UINavigationViewController

[英]Using a UINavigationViewController on its own

在我的應用程序中,它基於一個tabbar視圖控制器,每個tabbar項目有許多uinavigationviewcontrollers,我想在某個時候(在應用程序啟動時)調用presentModalViewController,它包含一個uinavigationcontroller作為root,這樣用戶可以做一些事情......當他或她完成時,可以點擊右上角的完成按鈕以關閉模態視圖控制器,然后返回到基本標簽欄視圖....如何使用Interface Builder?

在XCode中,創建一個新的View XIB文件並在Interface Builder中打開它。 在這個xib文件中,刪除View並將UINavigationController拖到它的位置。

然后,在您的視圖控制器代碼中,類似於

UINavigationController *controller = [[UINavigationController alloc] initWithNibName:@"ModalViewController" bundle:nil];
[self presentModalViewController:controller animated:YES];
[controller release];

將加載您的XIB並呈現它。

希望這有幫助,任何其他問題都毫不猶豫地評論這個答案!

小號

暫無
暫無

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

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