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
Set the layer Frame as
layer.frame = (CGRectMake(columnWidth * c + 0.5, 0.5, 0.5, self.layer.bounds.size.height));
Yeah it will work for retina also
Check this post Section 1 Point Lines and Pixel Boundaries.It is well explained there
I went ahead and made an explanatory picture, in case it's helpful to anyone
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.