iphone - UIBarButtonItem 通过编程在里面设置Action touch up

标签 iphone objective-c ios

在我的项目中,我通过编程保留了一个 UIBarbuttonItem,它工作正常,但我的问题是。如果我点击它,它不会像正常的 UIButton Touch up inside 事件那样闪烁。 下面是我如何实现的。

UIBarButtonItem *todayButton = [[UIBarButtonItem alloc] initWithTitle:@"Today"
         style:UIBarButtonSystemItemFlexibleSpace 
        target:self action:@selector(showTodaysDate)];
[toolBarItemArr addObject:todayButton];
[todayButton release];

如何以编程方式实现触摸事件

最佳答案

UIBarButtonItem 没有任何 touchupInside 事件。它不能表现得像 UIButton。它也没有选择或禁用图像。它只有启用或禁用状态。所以你不能像 UIButton 一样复制它。

关于iphone - UIBarButtonItem 通过编程在里面设置Action touch up,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6518115/

相关文章:

ios - 如何在 MapView IOS 中创建折线

ios - 如何重命名我的键盘扩展?

iphone - 为什么我收到错误 "[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x4e38c50'“?

objective-c - Mac 操作系统上的防病毒 API

ios - 对象从字典数组到数组

objective-c - IB中的子类化

ios - 使用配置文件测试飞行问题

iOs 两次部署相同的应用程序

iphone - flowcover View 替代方案(使用 uiwebview 而不是 uiimage)

objective-c - 在本地和远程之间切换 iOS 应用程序中使用的 url