I have this UIPickerView on my Storyboard :
and here's the position based on Size Inspector :
and here's my 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) {
}];
}
(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.
because if you do some a little math here you won't get that number :
iPhone screen height = 1136px, pickerview height = 216pts = 432px
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.
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.
plus, even worse... when I run on 3.5 inch Simulator it's not fully shown.
how to give X and Y value for UIPickerView so it will perfectly shown for both 3.5 and 4 inch retina display screen?
thank you.