我将 aCALayer作为子层添加到 aUIView的layer属性中,如下所示:
_graphicLayer = [[GraphicLayer alloc] init];
self.bounds = _graphicLayer.bounds;
_graphicLayer.position = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
[self.layer addSublayer:_graphicLayer];
如您所见,我更改了 _ 的位置graphicLayer以说明居中的anchorPoint. 添加此子层后,我注意到它正在将视图更改frame为(-self.bounds.width / 2, -self.bounds.height / 2). 为什么会这样?如果我改变 _ 的位置graphicLayer,我认为这只是相对于它的父视图。为什么它会影响 viewsframe属性?(而且我不想调整视图层属性的 anchorPoint 或_graphicLayer)。