我在表格单元格中有两个 UIButton,滚动时按下不便。我怎样才能防止这种情况?
我是否可以设置一些属性或发送事件,以便仅在用户释放按下时才按下按钮,而不是在按下按钮后立即按下?
我尝试了不同的触摸事件(Touch Up Inside 和 Touch Down),但似乎都没有解决这个问题。
您可以监听 tableview 的滚动委托(delegate)回调并关闭正在滚动的按钮
- (void)scrollViewWillBeginDraggingUIScrollView *)activeScrollView {
//I assume the buttons are within your cells so you will have to enable them within your cells so you will probably have to handle this by sending a custom message to your cells or accessing them with properties.
[yourButton setEnabled: NO];
}
并倾听
- (void)scrollViewDidEndDraggingUIScrollView *)scrollView willDecelerateBOOL)decelerate
{
// do the same to enable them back
[yourButton setEnabled: YES];
}
关于iphone - 滚动时防止按下 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11193538/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) | Powered by Discuz! X3.4 |