美文网首页
可以监听tabbar按钮点击的两个代理方法

可以监听tabbar按钮点击的两个代理方法

作者: 訷訷 | 来源:发表于2016-04-15 11:32 被阅读615次
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{   // 这里不需要调用super,因为父类没有实现这个代理方法
    // 调用了会报错,同时说明UITabBarController没有通过这个方法监听tabbar点击
    [super tabBar:tabBar didSelectItem:item];
}

细节:
Changing the delegate of 【a tab bar managed by a tab bar controller】 is not allowed.
被UITabBarController所管理的UITabBar,它的delegate不允许被修改

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
    NSLog(@"%s", __func__);
}

相关文章

网友评论

      本文标题:可以监听tabbar按钮点击的两个代理方法

      本文链接:https://www.haomeiwen.com/subject/iaknlttx.html