title: How to set UIImageView in the center of screen horizontally or vertically with Swift, but no more StoryBoard
body: <p>I am trying to put an <code>UIImageView</code> on the upper center of screen horizontally which is coding in the <code>viewDidLoad( )</code>. And I have two pre-plans, which means I do not know the specify functions or APIs.</p>
  
  <p>1). I want to set a variable which equal to the half of screen's width. And I know it gonna work with something about 'bounds' or 'frame'. Pathetically, I do not know those specify function or parameters. </p>
  
  <p>2). In order to make sure the resolution, I want to figure out the <code>currentDevice</code>. After that, I can set <code>UIImageView</code> with <code>CGRectMake((resolution.x)/2, y, length, width)</code>. Is there any function can confirm the <code>currentDevice</code>? </p>
  
  <p>And I think the first one is more efficient than the second one. </p>
  
  <p>A big appreciate for your help and guidance.</p>
  
  <p>Ethan Joe   </p>