I created a UIPickerView in code only when it appears that iOS 8 the view the item is positioned at the top. How do I get it down? This is the code used:
show actionsheet
pickerActionSheet = [self actionSheetSimulationWithPickerView:picker withToolbar:pickerViewToolbar];
// set frames on different orientation
if (UIDeviceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
picker.frame = CGRectMake(0, 32, SCREEN_HEIGHT, 162);
pickerViewToolbar.frame = CGRectMake(0, 0, SCREEN_HEIGHT, 32);
[pickerActionSheet setBounds:CGRectMake(0, 0, SCREEN_HEIGHT, 366)];
}
else{
picker.frame = CGRectMake(0, 44, SCREEN_WIDTH, 216);
pickerViewToolbar.frame = CGRectMake(0, 0, SCREEN_WIDTH, 44);
[pickerActionSheet setBounds:CGRectMake(0, 0, SCREEN_WIDTH, 496)];
}
After launching the iPhone 5 (taller screen), when you need something to start from the bottom, you need to do
SCREEN_HEIGHT-objectHeight
. If you want it to start from top you start with 0.Now the iPhone 6 and 6+ (wider screen) is here, you must do with the left and right side, left you start with 0 and right you start with
SCREEN_WIDTH-objectWidth
.So from now on, no one will be using width as just 320. If you want it the whole screen width, we all need to use
SCREEN_WIDTH
.