그래서 기본적으로 UIScrollView를 더 높은 각도로 스크롤하려고합니다. 현재와 마찬가지로 손가락을 수평에서 10도 이동하면 스크롤보기가 스크롤됩니다. 30도 정도까지 밀어 내고 싶습니다.프로그래밍 방식으로 스크롤하여 UIScrollView로 스크롤하여
몇 가지 독서를 한 후에 스크롤바 상단에 하위 클래스 UIView를 배치하는 것이 가장 좋은 방법입니다. 상단 터치의 UIView가 30도 이상인 경우 scrollview로 전달하고 그렇지 않으면 스크롤하지 않습니다.
그러나 터치를 전달하는 방법을 알 수 없습니다. 지금 내 코드는 다음과 같습니다.
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"glass touch began");
UITouch *touch = [touches anyObject];
beginning_touch_point = [touch locationInView:nil];
[scroll_view touchesBegan:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"glass touch ended");
UITouch *touch = [touches anyObject];
CGPoint previous_point = beginning_touch_point;
CGPoint current_point = [touch locationInView:nil];
float x_change = fabs(previous_point.x - current_point.x);
float y_change = fabs(previous_point.y - current_point.y);
if(x_change > y_change)
{
if(previous_point.x - current_point.x < 0)
{
[(MyScheduleViewController *)schedule_controller didFlickLeft];
}
else
{
[(MyScheduleViewController *)schedule_controller didFlickRight];
}
[scroll_view touchesCancelled:touches withEvent:event];
}
else
{
[scroll_view touchesEnded:touches withEvent:event];
}
}
저는 45도를 확인하고 있지만 지금은 중요하지 않습니다. 중요한 점은 터치가 실제로 내 scroll_view로 올바르게 전달된다는 것입니다. 나는 그것이 touchesbegan과 touchesended에 대해 NSLog()를 수행하고 있으며, 올바르게 수행하고있다. 스크롤 만하는 것이 아닙니다. 나는 건드린다고 걱정한다 .Began and touchesEnded는 스크롤을 일으킬 수 없다. 아무도 뭘 할 수 있는지, 내가 뭘 잘못하고 있는지 아는가 ??
감사합니다.
이 기능을 작동 시키셨습니까? 현재 비슷한 문제가 있습니다. –