How can i get Tabbar Item Button's Click event by clicking on TabbarItem button?

前端 未结 2 381
孤街浪徒
孤街浪徒 2020-12-16 00:56

I have taken UITabbar on that i have used two buttons as TabItem.I want to perform two different Action by clicking on that two button so how can i get particular Action on

2条回答
  •  遥遥无期
    2020-12-16 01:42

    -(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
    {
        if(item.tag==1)
        {
            //your code
        }
        else
        {
           //your code
        }
    }
    

    You can use UITabBarDelegate for keeping the track of which button is pressed by assigning the tag or title for title you can use item.title.

提交回复
热议问题