如何获得scrollview子视图相对于scrollview超级视图的中心点?

问题描述:

我有一个包含20个子视图(白色视图)的scollView(下图中显示的蓝色)。 enter image description here如何获得scrollview子视图相对于scrollview超级视图的中心点?

scrollView的superView被称为pView,例如,相对于pView的白色view1的中心点是(10,10),并且viewPoint6的中心点是(496,10),滚动后该视图如下: enter image description here

中心的观点6是(10,10),但我不知道如何得到它。

也许我应该使用如下代码

 CGPoint centerPoint = [view6 convertPoint:view6.center toView:pView]; 

,但我没有得到正确的点

view6.center是view6的上海华(这是的UIScrollView)的坐标系统相同。尝试

CGPoint centerPoint = [scrollView convertPoint:view6.center toView:pView];

+0

你是绝对正确的 – NOrder 2013-03-19 05:01:05