[英]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? 是否可以使用相同的层次结构对[view subviews]数组进行排序?
Thanks, Makrus 谢谢,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. 虽然我在文档中没有找到任何关于它的参考,但我很确定subviews
数组中元素的顺序对应于它们的z顺序。 You can try to change order of subviews in IB and log subviews to console - you will see that output supports that. 您可以尝试在IB中更改子视图的顺序并将子视图更改为控制台 - 您将看到输出支持该操作。
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... 还有一个暗示,它实际上是insertSubview:atIndex:
和exchangeSubviewAtIndex:withSubviewAtIndex:
更改子视图的z顺序的方法,这些更改反映在子视图数组顺序中...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.