是否可以使用UINavigationController但隐藏其导航栏(将其替换为自定义工具栏)并返回按钮 [英] Is it possible use UINavigationController but hide its navigation bar (replace it with customized toolbar) and go back button

查看:75
本文介绍了是否可以使用UINavigationController但隐藏其导航栏(将其替换为自定义工具栏)并返回按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I hope to switch between 2 UIViewController using UINavigationController. (AUIViewController, BUIViewController relate to UIView AView,BView)

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

AView has an UIButton, BView has an UIButton also. If I press the button on AView, it will push BViewController and display BView. If I press the button on BView, BViewController will pop and go back AUIViewController.

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

I hope to use UINavigationController's navigation function but hide its 'go back' bar and navigation bar, only use 2 buttons to tell UINaviationController what it needs to do. Is it possible?

推荐答案

隐藏UINavigationController的导航栏:

to hide UINavigationController's navigation bar:

[self.navigationController setNavigationBarHidden:YES];

从按钮推送视图控制器:

To push a view controller from a button:

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

要弹出一个视图控制器:

To pop a view controller back one:

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

这篇关于是否可以使用UINavigationController但隐藏其导航栏(将其替换为自定义工具栏)并返回按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆