Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CALayer and UIView display order

I have a CATiledLayer within a UIView and the UIView also contains a subview. How can I make sure that the subview is always drawn above the layer?

Most of the time I get the tile layer covering the subview.

like image 636
Charlie Avatar asked Jan 28 '26 16:01

Charlie


1 Answers

By default all layers (hence views) added in the last are drawn on the top. You can change the default with -insertSublayer:below: and similar methods:

 [view.layer insertSublayer:tiledLayer below:thatSubview.layer]
like image 118
kennytm Avatar answered Jan 31 '26 09:01

kennytm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!