UItabBarController setselectedindex viewWillAppear调用两次

时间:2014-12-03 07:28:05

标签: ios objective-c

CustomTabBar *tabar = (CustomTabBar*)self.tabBarController;
tabar.previousIndex = tabar.selectedIndex;
tabar.selectedIndex = INDEX_COLLECTION_BOX_VIEW_CONTROLLER;

CustomTabBar继承了uitabbarcontroller并点击了一个Buttton,执行上面的代码,但ViewController的viewWillAppear也调用了哪个索引INDEX_COLLECTION_BOX_VIEW_CONTROLLER。日志是

2014-12-03 15:15:08.724 SogalNew[4187:3180974] -[TeamViewController viewWillAppear:] [Line 63] index is:5 <br/>
2014-12-03 15:15:08.774 SogalNew[4187:3180974] -[CollectionController viewWillAppear:] [Line 88] index is:7 <br/>

和宏是:

define INDEX_CUSTOMER_DETAIL_VIEW_CONTROLLER 5
define INDEX_COLLECTION_BOX_VIEW_CONTROLLER 7
define INDEX_TEAM_VIEW_CONTROLLER 8


我点按的按钮属于索引== INDEX_CUSTOMER_DETAIL_VIEW_CONTROLLER的ViewController 我查了很久,无法解决,帮助我!!

0 个答案:

没有答案