title: How to get the centre of the view
body: <p>I'm trying to get the center of my view by using the code below, the class being used is from the <code>DTIActivityIndicatorView</code> which add a custom activity indicator to the view.</p>
  
  <pre><code>var midX = CGRectGetMidX(self.view.bounds)
  var midY = CGRectGetMidY(self.view.bounds)
  
  let topStoriesActivityIndicator: DTIActivityIndicatorView = DTIActivityIndicatorView(frame: CGRect(x: midX, y: midY, width:80.0, height:80.0))
  </code></pre>
  
  <p>But the code above is giving me the following result where the activity indicator isn't centered in the middle.</p>
  
  <p><img src="https://i.stack.imgur.com/h5fC7.png" alt="screenshot"></p>