簡體   English   中英

是否可以使用UINavigationController但隱藏其導航欄(將其替換為自定義工具欄)並返回按鈕

[英]Is it possible use UINavigationController but hide its navigation bar (replace it with customized toolbar) and go back button

我希望使用UINavigationController在2個UIViewController之間切換。 (AUIViewController,BUIViewController與UIView AView,BView相關)

AView有一個UIButton,BView也有一個UIButton。 如果我按下AView上的按鈕,它將推送BViewController並顯示BView。 如果我按下BView上的按鈕,BViewController將彈出並返回AUIViewController。

我希望使用UINavigationController的導航功能,但隱藏它的“返回”欄和導航欄,只使用2個按鈕告訴UINaviationController它需要做什么。 可能嗎?

隱藏UINavigationController的導航欄:

[self.navigationController setNavigationBarHidden:YES];

從按鈕推送視圖控制器:

- (void)pushNextViewController {
    NextViewController *page = [[NextViewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:page animated:YES];
}

要將視圖控制器彈回一個:

- (void)popToLastViewController {
    [self.navigationController popViewControllerAnimated:YES];
}

您也可以在界面構建器中隱藏它:

  • 選擇導航控制器對象
  • 在右側的第4個選項卡中,在“導航控制器”下,取消選擇“顯示導航欄”

暫無
暫無

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

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