Getting Co-ordinates of inner view corresponding to outer view
-
26-10-2019 - |
Question
My view controller has following hierarchy:
Month view -> Scroll View -> Calendar View -> Grid View -> Container View -> Tile view.
When user clicks the button which is placed in the Tile view, the new view should get added on MonthView -> Scroll View with X-Coordinate same as that of Container View.
I have tried following function :
CGRect tranformRect = [Container View convertRect:Container_View_Frame toView:Month view -> Scroll View]
But the X-Coordinate which I get is not which I required. Does I m doing any thing wrong? Attached are screen shots :
Thanx in advance.
Solution
It looks like you are misunderstanding what the frame rect is. The frame for any view is always expressed in its parent's coordinate system. Try converting containerView.bounds instead. Or ask gridView to make the conversion instead.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow