I am trying to apply line dash pattern to my UIBezierPath
which is drawn on a CAShapeLayer
. I had done this in web before using javascript and I got the result below for a specific set of array values:
{ var Stroke=[{'type':[{"LONG_DASH_DOT_DOT":"8,2,1,2,1,2"}]}]};
And using same array I draw dash pattern in Objective-C as follows:
shapeLayerForm.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:8],[NSNumber numberWithInt:2],[NSNumber numberWithInt:1],[NSNumber numberWithInt:2], [NSNumber numberWithInt:1],[NSNumber numberWithInt:2], nil];
Now, first screenshot is from a mac and second one is from iPad. Dimensions of both shapes the identical. As you can see, number of dashes in length of mac's rectangle is around four but in iPad's rectangle they are too many. I think this difference in length of dashes is due to resolution of the two devices, but I am not sure. Also, I want to know how to solve this issue.