gpt4 book ai didi

ios - UITableview 的触摸事件

转载 作者:行者123 更新时间:2023-11-29 04:09:07 25 4
gpt4 key购买 nike

我有一个 UIView 覆盖子类 UITableview。问题是,我无法让表格 View 滚动。我尝试过覆盖 touchesBegantouchesMovedtouchesEnded。然后我尝试覆盖 hittest 但这似乎没有影响。

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self];
NSLog(@"SMTable.touches began %@",NSStringFromCGPoint(touchPoint));
[super touchesBegan:touches withEvent:event];

}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self];
NSLog(@"SMTable.touches moved %@ for :%p",NSStringFromCGPoint(touchPoint),touch.view);
[super touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self];
NSLog(@"SMTable.touches ended %@",NSStringFromCGPoint(touchPoint));
[super touchesEnded:touches withEvent:event];
}
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event {
[super touchesCancelled:touches withEvent:event];
}
- (UIView*) hitTest:(CGPoint)point withEvent:(UIEvent *)event {
//NSLog(@"SMTable.hitTest %@",NSStringFromCGPoint(point));
return [super hitTest:point withEvent:event];
}

最佳答案

如果您的 UIView 位于 UITableView 上方,则所有触摸事件都将落在该 UIView 和您的 UITableView 中> 不会滚动。您需要禁用最上面的`UIView〜

的交互

关于ios - UITableview 的触摸事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14691797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com