iphone - 滚动时防止按下 UIButton
<p><p>我在表格单元格中有两个 UIButton,滚动时按下不便。我怎样才能防止这种情况? </p>
<p>我是否可以设置一些属性或发送事件,以便仅在用户释放按下时才按下按钮,而不是在按下按钮后立即按下? </p>
<p>我尝试了不同的触摸事件(Touch Up Inside 和 Touch Down),但似乎都没有解决这个问题。 </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您可以监听 tableview 的滚动委托(delegate)回调并关闭正在滚动的按钮</p>
<pre><code>- (void)scrollViewWillBeginDragging:(UIScrollView *)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.
;
}
</code></pre>
<p>并倾听</p>
<pre><code>- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
// do the same to enable them back
;
}
</code></pre></p>
<p style="font-size: 20px;">关于iphone - 滚动时防止按下 UIButton,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/11193538/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/11193538/
</a>
</p>
页:
[1]