不能圆角并且在ASDisplayNode上具有背景色

问题描述

我试图在设置背景色的同时创建一个带有圆角的ASdisplayNode。但是,拐角永远不会显示为圆角。为什么是这样?我的代码

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class,DataSourceTransactionManagerAutoConfiguration.class})

这只会创建一个没有圆角的矩形...

解决方法

删除此行

self.cornerRoundingType = .precomposited

我不太确定cornerRoundingType也是如何预合成的

在代码文档中所述

* - ASCornerRoundingTypePrecomposited: corners are drawn using bezier paths to clip the content in a
 * CGContext / UIGraphicsContext. This requires .backgroundColor and .cornerRadius to be set. Use opaque
 * background colors when possible for optimal efficiency,but transparent colors are supported and much
 * more efficient than CALayer. The only limitation of this approach is that it cannot clip children,and
 * thus works best for ASImageNodes or containers showing a background around their children.
 *

在仓库issue中也有人问这个问题