CALayer: Single pixel line looks like 2 pixels

前端 未结 2 682
梦谈多话
梦谈多话 2021-02-04 17:08

This is my code:

int columns 3;
int columnWidth = self.layer.bounds.size.width / 3;

for (int c = 1; c < columns; c++) {
    CALayer *layer  = [CALayer layer         


        
2条回答
  •  梦如初夏
    2021-02-04 17:50

    I went ahead and made an explanatory picture, in case it's helpful to anyone

    enter image description here

    The lower line on exact pixel coordinates and will look blurry... each half of the width of the line lies in a different row of pixels...

    The upper line is offset by line_width/2.0 and will look sharp... it lies completely within a row of pixels.

提交回复
热议问题