Reputation: 2493
I have a scollView(the blue one showing in the image below) containing 20 subviews(the white view).
the superView of scrollView is called pView, for example, the the center point of white view1 relative to pView is (10,10), and the center point of view6 is (496,10), after I scroll this the view as following:
the center point of view 6 is (10,10), but I don't know how to get it.
maybe I should use code like
CGPoint centerPoint = [view6 convertPoint:view6.center toView:pView];
but I didn't get the right point
Upvotes: 1
Views: 881
Reputation: 7102
view6.center is in the coordinate system of the superview of view6 (which is the UIScrollView). Try
CGPoint centerPoint = [scrollView convertPoint:view6.center toView:pView];
Upvotes: 3