开发者

UITabBar delegate's method not getting called when item is selected from a "More" view

开发者 https://www.devze.com 2023-02-15 18:59 出处:网络
I have overwritten the tab bar controller and tab bar item classes in my code. In the tab bar controller\'s delegate method - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item I added

I have overwritten the tab bar controller and tab bar item classes in my code. In the tab bar controller's delegate method - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item I added some code to set initial values to the selected item's properties.

The method is called when I select the item from a tabbar. But, since I added some more buttons to the bar, I got the ... button, with "More" - that shows up a list of hidden items when is pressed.

The problem is, when I 开发者_运维技巧select one of those "hidden" items, it loads up the view controller that should be loaded, but doesn't call the didSelectItem method in my class, so the initial property setting made there is not done.

Should I implement some other methods in there? Or am I doing it the wrong way?


Maybe this method is not called for view controllers in "More". You could try to do your configuration in

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
0

精彩评论

暂无评论...
验证码 换一张
取 消