双UIScrollView同步 - 不同的高度 [英] Double UIScrollView synchronization - Different height

查看:99
本文介绍了双UIScrollView同步 - 不同的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在同一页面中使用2 UIScrollView 开发iPad应用程序。
在左侧,有内容,在右侧,有一些集团,新闻。这两个 UIScrollView 是不同的高度大小。

I'm currently developping iPad application with 2 UIScrollView in the same page. On the left side, there is the content and on the right side, there are some bloc, news. These two UIScrollView are different height size.

示例:左1000,右2000.

Example : left 1000, right 2000.

我想同步2 UIScrollView ,我解释一下:

I would like to synchronize the 2 UIScrollView, I explain me :

当用户向左滚动时 UIScrollView 要在底部访问,右边的 UIScrollView 滚动在同一时间。如果左侧UIScrollView恰好位于底部,而右侧 UIScrollView 不在底部,则右侧 UIScrollView 继续滚动直到...它自然停止。

如果用户在右侧UIScrollView上滚动,则行为相同。

When the user scrolls on the left UIScrollView to access on the bottom, the right UIScrollView "scrolls" in the same time. If the left UIScrollView is happened to be at the bottom, and the right UIScrollView is NOT on the bottom, the right UIScrollView continue to scroll until ... it stop naturally.
And the same behavior if the user scroll on the right UIScrollView.

你有吗?一个想法如何解决或处理我的问题?

Do you have an idea how to resolve or to handle my problem ?

推荐答案

我会发布我用过的解决方案,以防任何人到达将来这个问题。

I'll just post the solution I used in case anyone gets to this question in the future.

您不直接设置 contentOffset 。你需要做一个解决方法。像这样:

You don't set the contentOffset directly. You need to do a workaround. Like so:

CGRect viewToUpdateBounds = viewToUpdate.bounds;
viewToUpdateBounds.origin = scrolledView.contentOffset;
viewToUpdate.bounds = viewToUpdateBounds;

问候

这篇关于双UIScrollView同步 - 不同的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆