title: Objective-C - drawing a horizontal line through the middle of the screen
body: <p>I'm trying to draw a horizontal line through the middle of the screen of an app that has a navigation bar. Here's my current code to do so:</p>
  
  <pre><code>CGFloat screenWidth = self.view.frame.size.width;
  CGFloat screenHeight = self.view.frame.size.height;
  CGFloat navigationBarHeight = self.navigationController.navigationBar.frame.size.height;
  CGFloat lineThickness = 3;
  
  UIView *horizontalLine = [[UIView alloc] initWithFrame:CGRectMake(0, (screenHeight - navigationBarHeight) / 2, screenWidth, lineThickness)];
  [self.view addSubview:horizontalLine];
  </code></pre>
  
  <p>I used a very similar calculation to draw a vertical line - and that worked just fine. But, the issue is, regardless of device, this horizontal line ends up too low on the screen by roughly 10 pixels. Is there an offset I may be missing? Something to do with the navigation bar perhaps?</p>