在我的项目中,我通过编程保留了一个 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/