ios - 在基于 View 的应用程序中使用 UITabBar 不起作用

标签 ios uitabbar

我已将 UITabBar 添加到基于 View 的应用程序,如下所示连接我的 View Controller :

@interface SomeViewController : UIViewController<UITabBarDelegate> {    

...

UITabBar *tabBar;

...

@property (nonatomic, retain) IBOutlet UITabBar *tabBar;

在我的实现文件中,我这样做了:

@synthesize tabBar;

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

我进入 IB 并将 tabBar 连接到 File's Owner tabBar。

我的问题:单击选项卡栏项永远不会触发 didSelectItem 方法。我是不是错过了一步或做错了一步?

最佳答案

你有没有把tabbar的delegate设置为self?

关于ios - 在基于 View 的应用程序中使用 UITabBar 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5772681/

相关文章:

ios - 当不在相机视野中时停止 SKVideoNode 播放

ios - 如何在 TableViewController B 中选择行时在 ViewController A 中启用 UI 按钮

uitabbar - 从 AppDelegate 访问选项卡 Controller

uitabbarcontroller - UITabBarDelegate 还是 UITabBarControllerDelegate?

iphone - 是否可以自定义 UITabBarItem 角标(Badge)?

swift - 以编程方式调用 View 后选项卡栏消失

iphone - 如何让处理程序重复 UIView animateWithDuration?

ios - Objective-C iOS6 [ ] 运算符重载(const id [])

ios - NSData dataWithContentsOfURL:不返回浏览器中显示的URL的数据

iOS 9 应用程序支持在 App Store 中发布应用程序