我希望使用 UINavigationController 在 2 个 UIViewController 之间切换。 (AUIViewController, BUIViewController 与 UIView AView,BView 相关)

AView 有一个 UIButton,BView 也有一个 UIButton。
如果我按下 AView 上的按钮,它将插入 BViewController 并显示 BView。
如果我按下 BView 上的按钮,BViewController 将弹出并返回 AUIViewController。

我希望使用 UINavigationController 的导航功能,但隐藏其“返回”栏和导航栏,只使用 2 个按钮告诉 UINavigationController 它需要做什么。
是否有可能?

最佳答案

隐藏 UINavigationController 的导航栏:

[self.navigationController setNavigationBarHidden:YES];

从按钮推送 View Controller :
- (void)pushNextViewController {
    NextViewController *page = [[NextViewController alloc] initWithNibName:nil bundle:nil];
    [self.navigationController pushViewController:page animated:YES];
}

弹出一个 View Controller :
- (void)popToLastViewController {
    [self.navigationController popViewControllerAnimated:YES];
}

关于iphone - 是否可以使用 UINavigationController 但隐藏其导航栏(用自定义工具栏替换它)并返回按钮,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4489398/

10-13 08:44