iphone - UIButton 过度敏感

标签 iphone cocoa-touch uikit

我在 tableviewCellWithReuseIdentifier 中定义了一个 UIButton。

该按钮可以使用,但非常敏感。如果我只需点击按钮,它就会起作用。长时间按下它不会触发该操作,即使它确实闪烁表明它知道它已被按下。为什么会发生这种情况?更重要的是,我该如何解决它。

这是单元格内 UIButton 的代码。

CGRect rect = CGRectMake(190.0, 2.0, 40.0, ROW_HEIGHT);
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button setTag:LBUTTON_TAG];
[button setFrame:rect];
[button addTarget:self action:@selector(leftbutton:) forControlEvents:UIControlEventTouchUpInside];
[button setAlpha:0.5];
[cell addSubview:button];

最佳答案

可能性不大,但是:您是否有任何异步后台进程可能在点击和点击之间调用 [tableView reloadData]?这可能会导致 UITableViewCell 的鼠标点击处理重置一些内部数据,使其“忘记”按钮内的点击操作,这可能导致它无法触发 UIControlEventTouchUpInside 事件,因为它不记得点击操作。

关于iphone - UIButton 过度敏感,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3929140/

相关文章:

iphone - 推特 API : Decode string returned by getFollowerIDsFor from Twitter (MGTwitterEngine for Obj-C)

iphone - 更改当前 iphone 应用程序的区域设置(NSBundle 的自定义区域设置?)

iphone - UITabbarController + UINavigationController,使用 UIToolbar 代替标签栏的详细 View

ios - 将颜色选择器添加到 iOS 应用程序

objective-c - iOS 中最常见的目标版本是什么

iphone - viewDidLoad什么时候被调用?

iphone - 在纵向 UITabBarController/UINavigationController 中显示横向 UIViewController

iphone - 从 iPhone 应用程序链接 appStore 上的开发者页面

objective-c - GCD 计时器从不触发

ios - 防止这种与可选相关的崩溃的最佳方法是什么?