开发者

Is CALayer insertSublayer: atindex: destructive?

开发者 https://www.devze.com 2022-12-11 16:29 出处:网络
The documentation is not clear on what happens the the layer currently atindex:xy when using insertSublayer:abc.layer atindex:xy.

The documentation is not clear on what happens the the layer currently atindex:xy when using insertSublayer:abc.layer atindex:xy. My experimentation has had mixed results. My understa开发者_JAVA百科nding is index 0 is furthest from the user (all other layers would be above that one).

If I call insertSublayer:abc.layer atindex:0, and def.layer is already at index:0, does def.layer get destroyed, or shifted to index:1?

Thanks.


It is not destructive. insertSublayer:atIndex: just inserts that sublayer at that index in the sublayers array, and has all the normal behavior associated with array insertion in an NSMutableArray


def.layer gets shifted to index:1, insertSublayer does simple insertion, NOT replacement.

0

精彩评论

暂无评论...
验证码 换一张
取 消