如何检测UITableView
上的垂直UIPanGestureRecognizer
。我可以检测水平,但仅在垂直方向上显示UITableView
卷轴,而且我无法获取平移事件。在UITableView中检测垂直扫视
2
A
回答
6
UITableView
是UIScrollview
子类,所以你可以弄个很panGestureRecognizer
,并添加自己的行动目标。
2
的UITableView的是的UIScrollView的子类,那么你就可以访问panGestureRecognizer财产
panGestureRecognizer的基本手势识别泛 手势。 (只读)
@属性(非原子,只读)UIPanGestureRecognizer * panGestureRecognizer
也见的UITableViewDelegate方法
4
有关使用UITableView
小号的委托,而不是什么? UITableViewDelegate
符合UIScrollViewDelegate
,所以你可以使用任何的这些方法,例如:
– scrollViewDidScroll:
– scrollViewWillBeginDragging:
– scrollViewWillEndDragging:withVelocity:targetContentOffset:
– scrollViewDidEndDragging:willDecelerate:
0
希望这对你有所帮助。
typedef enum : NSInteger
{
kPanMoveDirectionNone,
kPanMoveDirectionUp,
kPanMoveDirectionDown,
kPanMoveDirectionRight,
kPanMoveDirectionLeft
} PanMoveDirection;
-(PanMoveDirection)determineDirectionIfNeeded:(CGPoint)translation
{
if (direction != kPanMoveDirectionNone)
return direction;
// determine if horizontal swipe only if you meet some minimum velocity
if (fabs(translation.x) > 20)
{
BOOL gestureHorizontal = NO;
if (translation.y == 0.0)
gestureHorizontal = YES;
else
gestureHorizontal = (fabs(translation.x/translation.y) > 5.0);
if (gestureHorizontal)
{
if (translation.x > 0.0)
return kPanMoveDirectionRight;
else
return kPanMoveDirectionLeft;
}
}
// determine if vertical swipe only if you meet some minimum velocity
else if (fabs(translation.y) > 20)
{
BOOL gestureVertical = NO;
if (translation.x == 0.0)
gestureVertical = YES;
else
gestureVertical = (fabs(translation.y/translation.x) > 5.0);
if (gestureVertical)
{
if (translation.y > 0.0)
return kPanMoveDirectionDown;
else
return kPanMoveDirectionUp;
}
}
return direction;
}
call direction = [self determineDirectionIfNeeded:translation];在你的pangesture有针对性的方法
相关问题
- 1. 在引擎中水平和垂直检测轻扫手势
- 2. 线扫扫描水平和垂直组点检测
- 3. UITableview垂直ScrollView
- 4. 垂直UITableView内水平UITableView
- 5. 在UITableview中水平和垂直滚动
- 6. 如何垂直移动UITableView
- 7. 垂直的UITableView节头
- 8. UITableView中垂直居中的UITableViewCell
- 9. 检测垂直或水平位置iOS
- 10. 检测最低的垂直div第
- 11. UITableview中的水平和垂直scrollview ios
- 12. 无法在垂直视图中实现垂直CircleIndicator寻呼机
- 13. 在NSTableView中检测垂直NSScroller击中底部
- 14. 垂直视差jQuery中
- 15. 在opencv中使用Hough变换检测垂直线
- 16. 寻找OpenGL的垂直回扫时间
- 17. UITableView contentInset使表视图水平滚动除了垂直
- 18. UITableView上的垂直手势识别
- 19. 垂直网格线分组的UITableView
- 20. 如何禁用垂直滚动的UITableView?
- 21. 停止嵌入式UITableView垂直偏移
- 22. 水平和垂直滚动UITableView
- 23. 如何垂直滚动两个UITableView
- 24. UITableView垂直和水平滚动
- 25. 使用垂直滚动检测UIScrollView中的水平滑动
- 26. MATLAB:检测灰度图像中的非连续垂直条纹
- 27. 如何检测DataGridView控件中的垂直滚动条
- 28. 如何检测图像中的部分垂直/水平线?
- 29. 在iphone 3gs上检测垂直(y轴)旋转
- 30. 检测UITableView滚动
你能详细说明吗? – scord