标签栏图标中的UIAlertview

时间:2012-06-27 05:12:31

标签: iphone xcode ios5

如何使标签栏图标可点击。点击它后,应该会弹出一个提醒或警告(UIAlertView)。

我知道如何展示UIAlertView,但我想点击标签栏图标时发出提醒。

1 个答案:

答案 0 :(得分:2)

首先,您需要将UITabBarController设置为其委托,并使用方法didSelectItem

.h添加<UITabBarDelegate>

viewDidLoad

  yourTabBarController.delegate=self;

然后使用委托方法:

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item
{

     if(item == yourAlertTab)

     {

        //Code to show alert.

     }
}
相关问题