我正在尝试使用Xcode 6.3构建无限时间轴。我有两个同步的,无限的ScrollViews。一个滚动视图显示内容,另一个显示日期。带有天数的滚动视图仅在x方向上滚动。内容滚动视图向两个方向滚动。日滚动视图应始终可见(如标题)。
我使用Apple StreetScroller方法进行无限滚动。对于同步,我使用以下代码:
- (void)setSynchronizedScrollView:(UIScrollView*)scrollview
{
// don't retain the watched view, because we assume that it will
// be retained by the view hierarchy for as long as we're around.
synchronizedScrollView = scrollview;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGPoint offset = synchronizedScrollView.contentOffset;
offset.x = self.contentOffset.x;
[synchronizedScrollView setContentOffset:offset];
}
两个滚动视图不同步滚动?解决这个问题的最佳方法是什么?
感谢您的帮助!
答案 0 :(得分:0)
将此委托添加到您的班级:UIGestureRecognizerDelegate
的OBJ-C:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
夫特:
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool
覆盖此功能并返回true