草庐IT

contentsScale

全部标签

iphone - 尽管设置了 contentsScale,为什么 CAShapeLayer 还是太大了?

我有一个CAShapeLayer,我用它在条形图中绘制小点。问题是它们在视网膜显示器上都太大了。我已设置contentsScale并检查它是否已设置。我仍然看不出有没有它有什么区别!CAShapeLayer*lineShapeLayer=[CAShapeLayerlayer];lineShapeLayer.contentsScale=[[UIScreenmainScreen]scale];CGMutablePathRefpath=CGPathCreateMutable();lineShapeLayer.backgroundColor=[UIColorclearColor].CGColo

ios - 什么时候需要设置 CALayer 的 contentsScale 属性?

在documentationApple声明在以下情况下您需要考虑层的比例因子:CreatesadditionalCoreAnimationlayerswithdifferentscalefactorsandcompositesthemintoitsowncontentSetsthecontentspropertyofaCoreAnimationlayerdirectly最后一句话我不是很清楚。他们还说:ApplicationsthatuseCoreAnimationlayersdirectlytoprovidecontentmayneedtoadjusttheirdrawingcode