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

当ViewController设置的self.title和tabBarItemsAttributes中对应的title不一致的时排序不对 #11

Closed
ChenYilong opened this issue Oct 29, 2015 · 7 comments
Labels

Comments

@ChenYilong
Copy link
Owner

童鞋 发现了一个 bug:

发现了一个bug,当ViewController设置的self.title和tabBarItemsAttributes中对应的title不一致的时候,会出现如图的错误,排序不对了。Debug的时候发现会多执行了自定义TabBar的layoutSubviews方法,UIView *childView in self.subviews这句话获得的内存都不一样了。

Uploading 71e73aefjw1exht9ai8tzj20ho07saav.jpg…

我会相应地跟进。

@ChenYilong ChenYilong added the bug label Oct 29, 2015
@kingloveyy
Copy link

我也遇到这个问题了呢

@ChenYilong
Copy link
Owner Author

@kingloveyy 暂时的解决方案是,只设置一处,比如如果想在 VC 里设置,就没必要在 appdelegate 里设置了。方便的话,加我 QQ1356701892 详聊下

@UniverseKing
Copy link

这个问题有解决吗,两处title不一样就有问题哦

@kapop
Copy link

kapop commented Dec 20, 2015

如题+1

@ChenYilong
Copy link
Owner Author

好的,我会看下该问题。也欢迎大家提pr

@maqihan
Copy link

maqihan commented Jan 27, 2016

楼主分享的这个自定义tabbar我研究了一下,自定义的方式很受启发,谢谢楼主。同时在使用中我也发现了这个顺序错乱的问题,通过实验已经知道这个问题出在哪里并修复了这个问题,只在楼主自定义的tabbar的类中加入一个方法就可以了,想要的朋友加我1250307429,我也是第一次用这个东西,不清楚这样修改系统的tabbar对于审核有没有问题,应用正在审核中。希望没啥问题。。。

@ChenYilong
Copy link
Owner Author

@maqihan @kapop @UniverseKing @kingloveyy

v1.0.7版本已经修复了该 bug,请升级重试下。

虽然修复了,但也请遵循如下规则:
请勿使用 self.title = @"同城"; 这种方式,请使用 self.navigationItem.title = @"同城";

self.title = @"同城";

by this way, it may cause bug like this:

enter image description here
规则如下:

    self.navigationItem.title = @"同城";    //✅sets navigation bar title.The right way to set the title of the navigation
    self.tabBarItem.title = @"同城23333";   //❌sets tab bar title. Even the `tabBarItem.title` changed, this will be ignored in  tabbar.
    self.title = @"同城1";                  //❌sets both of these. Do not do this‼️‼️ This may cause something strange like this : http://i68.tinypic.com/282l3x4.jpg .

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

No branches or pull requests

5 participants