title: Setting CAShapeLayer lineWidth Less Than 1
body: <p><a href="https://i.stack.imgur.com/BJbZI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BJbZI.png" alt=""></a></p>
  
  <p>In the above screen shot, there are two lines:</p>
  
  <ol>
  <li>Solid line is just a <code>UIView</code> with 1px height</li>
  <li>Dashed line is created using this code</li>
  </ol>
  
  <hr>
  
  <pre><code>- (void)viewDidAppear:(BOOL)animated {
      CAShapeLayer *line = [CAShapeLayer layer];
      UIBezierPath *linePath=[UIBezierPath bezierPath];
  
      [linePath moveToPoint:CGPointMake(0, 107)];
      [linePath addLineToPoint:CGPointMake(self.view.frame.size.width, 107)];
  
      line.lineWidth = 0.5;
      line.path=linePath.CGPath;
      line.fillColor = [[UIColor blackColor] CGColor];
      line.strokeColor = [[UIColor blackColor] CGColor];
  
      [line setLineJoin:kCALineJoinRound];
      [line setLineDashPattern: [NSArray arrayWithObjects:[NSNumber numberWithInt:10], [NSNumber numberWithInt:5],nil]];
  
      [[self.view layer] addSublayer:line];
  }
  </code></pre>
  
  <p>Why is a <code>UIView</code> of 1-pixel (<code>1.0</code>) height less than a dashed line of <code>0.5</code> height?</p>
  
  <p>I want the dashed line to be as slim as solid line.</p>