라이브러리의 이미지를 통해 페이지를 넘기는 데 사용하는 UIScrollView 컨트롤러에서 파생 된 뷰가 있습니다. 그건 잘 작동합니다.UIView를 통해 UIScrollView가 작동하지 않는 상태로 넘어갑니다.
오른쪽에 UIView를 겹쳐서 이미지 목록을 빠르게 스크롤하기위한 터치를 처리했습니다. 내 문제는 그 중 하나를 'super'또는 'nextResponder'를 통해 터치를 통과하면 절대 UIScrollView 개체를 아래에 만들지 않는다는 것입니다.
내 질문은 내가 처리 할 필요가없는 터치를 처리하도록 아래의 UIScrollView를 강제로 어떻게 할 수 있습니까? 그 시간 동안 모든 터치가 처리 할 UIScrollView로 전달되는 0.3 초 동안 타이머를 설정하고 있습니다. 따라서 사용자가 페이지를 넘기기 위해 스 와이프 제스처를 시작하면 문제가 발생합니다.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
// Start a timer to trigger the display of the slider and the processing of events.
touchesTimer = [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(showSlider:) userInfo:nil repeats:NO];
// Where are we at right now?
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:self.view];
lastPage = [self page:currentPoint.y];
// Pass the event though until we need it.
// [self.nextResponder touchesBegan:touches withEvent:event];
if ([touch.view isKindOfClass:[UIScrollView class]])
{
if (self.nextResponder != nil &&
[self.nextResponder respondsToSelector:@selector(touchesEnded:withEvent:)])
{
[self.nextResponder touchesEnded:touches withEvent:event];
}
}
}
나는 무엇이 잘못 될 수 있는지 알았을 것 같아요. 오른쪽의 슬라이더가 전체 화면을 덮지 않으므로 터치 이벤트의 좌표가 올바르지 않습니다. 보기 크기를 늘리고 터치 위치로 필터링 해보겠습니다. – Sophtware
올해 WWDC에서 고급 scrollview 기술에 대한 훌륭한 프레젠테이션이있었습니다. 당신은 그것을 보는 시간을 보내고 싶을 수도 있습니다. 이 상황에서 여러분에게 큰 도움이 될 것입니다. 이 비디오는 iTunes U 섹션 또는 Apple 개발자 사이트에서 iTunes로 볼 수 있습니다. –