简体   繁体   English

iOS:ScrollView的SetContentOffset不起作用

[英]iOS: SetContentOffset for Scrollview doesn't work

I have 3 Scrollviews and they should scroll synchron with the other... 我有3个Scrollview,它们应该与其他滚动同步...

But this code doesn't work: 但是此代码不起作用:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
[rowIdCellScrollView setContentOffset:CGPointMake(0, contentScrollView.contentOffset.y)];
[headerScrollView setContentOffset:CGPointMake(contentScrollView.contentOffset.x, 0)];
}

Do you have UIScrollViewDelegate? 你有UIScrollViewDelegate吗? And set delagate: 并设置脱盐:

rowIdCellScrollView.delegate = self;

And does this scrollViewDidScroll even call? 并且这个scrollViewDidScroll甚至调用吗?

我找到了解决方案,问题是,我在layoutsubviews中初始化了组件...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM