Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hidesBottomBarWhenPushed #10

Open
xaoxuu opened this issue Apr 28, 2017 · 0 comments
Open

hidesBottomBarWhenPushed #10

xaoxuu opened this issue Apr 28, 2017 · 0 comments

Comments

@xaoxuu
Copy link
Owner

xaoxuu commented Apr 28, 2017

hidesBottomBarWhenPushed

push到子控制器的时候隐藏底部tabbar。

此方法原本属于UIViewController,写在要push的viewController里。

如果一个导航控制器想要让所有push的子控制器都隐藏tabbar。

一般的做法是继承,在一个父类- (void)viewDidLoad中加上这么一行代码:

[self hidesBottomBarWhenPushed]; // available(0.0.6)

现在你有了另一种选择,“设置”这个导航控制器,让它push的子控制器都隐藏tabbar。

在导航控制器的- (void)viewDidLoad中加上这么一行代码:

[self ax_hidesBottomBarWhenPushed:YES]; // available(0.0.6)

作者注:

实现这个功能主要技术点是如何取消交换方法。

单纯地取消就是再交换一次,但是实际应用必须判断是否交换过,只有交换过才能再交换一次负负得正,否则会产生错乱。

为了判断是否交换过,我查阅了很多资料,也在很多技术群里询问,没有得到一个优雅的解决方案。只能采取比较笨的方法:就是在交换的时候做一个标记,通过标记值判断该方法指针是否指向原地址。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant