实际上,transform only视图是
CATransformLayer
层。
所以问题应该是
How to detect a UIView which has transform-only layer?
答案很简单,看看班级的类型
view.layer
.
例如,当你想改变
cornerRadius
在
stackView.layer
,它将通过一个警告
在仅变换层中更改属性cornerRadius,将不起作用
不是因为有什么东西叫做
transform-only view
,因为你在改变
中心半径
在一
转换层
和
中心半径
根据忽略属性
Apple document for CATransformLayer
。
仅渲染变换层的子层。忽略由层渲染的calayer属性,包括:背景颜色、内容、边框样式属性、笔划样式属性等。
也许你错了
可以在视图的层上执行操作,但不能全部执行。
如何检测
UIView
仅转换视图吗?-使用下面的扩展名
extension UIView {
func isTransformOnlyView() -> Bool {
return self.layer.isKind(of: CATransformLayer.self)
}
}
用法
stackView.isTransformOnlyView()