问题描述
我需要创建一个滚动网格的按钮。我想到的最简单的方法是使用一个uitableview和在运行时绘制按钮,每个单元格3个按钮。这工作正常,但问题出现时,试图滚动表。如果用户试图滚动表,但触摸从按钮开始,则表视图不接收事件,因此不滚动,我需要的行为类似于iphone跳板的行为,即用户可以浏览,即使触摸从按钮开始。
I need to create a scrolling grid of buttons. The easiest way I could think was to use a uitableview and draw the buttons on at run time, 3 buttons per cell. This works fine but the problem comes when trying to scroll the table. If the user tries to scroll the table but the touch begins on the button then the tableview does not receive the event and therefore does not scroll, I need the behaviour to be similar to that of the iphone springboard, ie user can page through even if touch begins on a button. Does anyone know how this is achieved... Touch forwarding or something else?
非常感谢
Jules
推荐答案
您可以转发以下事件:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([touches count] == 1)
{
//Your code here than should return if it reacts to touch
}
//forwarding action:
[self.nextResponder touchesBegan:touches withEvent:event];
}
这篇关于在uitableview触摸转发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!