What's the best way to add a drop shadow to my UIView

前端 未结 7 1152
自闭症患者
自闭症患者 2020-12-04 05:20

I am trying to add a drop shadow to views that are layered on top of one another, the views collapse allowing content in other views to be seen, in this vein i want to keep

相关标签:
7条回答
  • 2020-12-04 06:05

    So yes, you should prefer the shadowPath property for performance, but also: From the header file of CALayer.shadowPath

    Specifying the path explicitly using this property will usually * improve rendering performance, as will sharing the same path * reference across multiple layers

    A lesser known trick is sharing the same reference across multiple layers. Of course they have to use the same shape, but this is common with table/collection view cells.

    I don't know why it gets faster if you share instances, i'm guessing it caches the rendering of the shadow and can reuse it for other instances in the view. I wonder if this is even faster with

    0 讨论(0)
提交回复
热议问题