Control drag your tabbar to your "File's owner" in IB and set it as the delegate. Next drop this code in your viewcontroller.m file:
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{
if(item.tag == 0)
{
//party like its 1999 right here
}
}
Go back to IB and set each tab bar item in your tab bar with a tag. You gotta test for each case in your didSelectItem, so if you got more than one set a different tag etc. Thats how I did it anyway.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…