简体   繁体   中英

how to compare the hierarchical order of two subviews?

I want to find a way how I can compare the actual hierarchical order of two subviews.

As i didn't find a method who turns out to give me this kind of result, I want to ask you. Im sure there must be a way to do this.

Is it possible, that the [view subviews] array is ordered with the same hierarchy?

Thanks, Makrus

Although I have not find any reference about that in docs I'm pretty sure that the order of elements in subviews array corresponds to their z-order. You can try to change order of subviews in IB and log subviews to console - you will see that output supports that.

One more hint that it is really so are insertSubview:atIndex: and exchangeSubviewAtIndex:withSubviewAtIndex: methods which change subview's z-order and those changes are reflected in subviews array order...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM