title: CGRectMake : How To Calculate X and Y For UIPickerView Animation?
body: <p>I have this UIPickerView on my Storyboard :</p>
  
  <p><img src="https://i.stack.imgur.com/7zi9Y.png" alt="enter image description here"></p>
  
  <p>and here's the position based on Size Inspector :</p>
  
  <p><img src="https://i.stack.imgur.com/vucOm.png" alt="enter image description here"></p>
  
  <p>and here's my code :</p>
  
  <pre><code>- (void)showPickerView
  {
      [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
          self.picker.frame = CGRectMake(0 , 288,  self.picker.frame.size.width,  self.picker.frame.size.height);
          self.picker.hidden = NO;
      }
      completion:^(BOOL finished) {
      }];
  }
  </code></pre>
  
  <p>(after trial and error) in order to be placed correctly (bottom) on 4-inch screen, I have to set 288 as Y. I have no idea where this number come from.</p>
  
  <p>because if you do some a little math here you won't get that number :</p>
  
  <p>iPhone screen height = 1136px, pickerview height = 216pts = 432px</p>
  
  <p>if X and Y measured from TOP-LEFT (0, 0), then for 4 inch screen I should use 1136 - 432 = 704 px / 2 = 352pts. not 288pts.</p>
  
  <p>but according to Size Inspector' origin, this object measured from bottom left. so, (0,0) of X and Y now measured from BOTTOM-LEFT. you still won't get that number.</p>
  
  <p>plus, even worse... when I run on 3.5 inch Simulator it's not fully shown.</p>
  
  <p>how to give X and Y value for UIPickerView so it will perfectly shown for both 3.5 and 4 inch retina display screen?</p>
  
  <p>thank you.</p>