假设一个 CALayer 会生成一些子 layers ,重置的时候,各位是用removeFromSuperlayer
,还是直接sublayers = []
?
class Mycalayer: CALayer {
func update () {
// insert some Sublayers here
.....
}
func refresh () {
// reset all sublayers
self.sublayers?.forEach { layer in
layer.removeFromSuperlayer()
}
// OR Just
self.sublayers = []
}
}
1
timelessg 25 天前 via Android
当然是都要做了,不然引用一直在
|