仅有CALayer层的View
有些View虽然是UIView,但是仅有CALayer层,所以不能通过调用 .layer 来改变一些layer层的属性,如StackView,报错如下
1 | ......<CATransformLayer: 0x60800023f120> - changing property backgroundColor in transform-only layer, will have no effect |
解决方法是,自己新建一个Layer当作Background
1 | CALayer *background = [CALayer layer]; |