From UIView docs:
(void)insertSubview:(UIView *)view atIndex:(NSInteger)index
It's great that I can insert a UIView at a certain index, but I cannot find a way to READ what index a given UIView has.
I need to check whether the UIView is on top, or at the back ...
EDIT: Now that Brandon pointed out the order in the subviews array, I put together a UIView Category free for download providing few handy methods to handle the subviews hierarchy here: http://www.touch-code-magazine.com/uiview-layout-hierarchy-uiview-category-to-download/
I am almost 100% sure that the index is the same as the index of the subView inside the superViews
subviews
property.I just tested this with the following code and it works
Set up a recursive method as follows:
Then call it with:
Output: