Tôi đang cố gắng giới hạn vùng vuốt của UIScrollview, nhưng tôi không thể làm điều đó.Vùng quét giới hạn UIScrollview
Tôi muốn đặt khu vực vuốt chỉ lên đầu UIScrollview, nhưng tôi muốn đặt tất cả nội dung hiển thị.
Cập nhật:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([touches count] > 0) {
UITouch *tempTouch = [touches anyObject];
CGPoint touchLocation = [tempTouch locationInView:self.categoryScrollView];
if (touchLocation.y > 280.0)
{
NSLog(@"enabled");
self.categoryScrollView.scrollEnabled = YES;
}
}
[self.categoryScrollView touchesBegan:touches withEvent:event];
}
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
// [super touchesEnded:touches withEvent:event];
self.categoryScrollView.scrollEnabled = YES;
[self.categoryScrollView touchesBegan:touches withEvent:event];
}
Giải pháp: không quên để thiết lập delaysContentTouches để NO trên UIScrollView
self.categoryScrollView.delaysContentTouches = NO;
Đẹp nhất! 2 năm sau, bạn đã giúp tôi: P – NSPunk