Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/notes/bugfix-15070.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# mobilePick position wrong on iOS8.2 and iPhone 6 scaled
12 changes: 9 additions & 3 deletions engine/src/mbliphonepick.mm
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,14 @@ - (void) startPicking: (NSArray *)p_pickerOptions andInitial: (NSArray *)p_initi
// compute orientation
bool t_is_landscape;
t_is_landscape = UIInterfaceOrientationIsLandscape(MCIPhoneGetOrientation());

// PM-2015-03-25: [[ Bug 15070 ]] Make the y-pos scale to the height of the device rather than a hard coded value
CGFloat t_portrait_height, t_landscape_height;
t_portrait_height = [[UIScreen mainScreen] bounds] . size . height / 11 ;
t_landscape_height = [[UIScreen mainScreen] bounds] . size . height / 15 ;

// create the pick wheel
pickerView = [[UIPickerView alloc] initWithFrame: CGRectMake(0, (t_is_landscape ? 32 : 44), 0, 0)];
pickerView = [[UIPickerView alloc] initWithFrame: CGRectMake(0, (t_is_landscape ? t_landscape_height : t_portrait_height), 0, 0)];
pickerView.delegate = self;

// HC-2011-10-03 [[ Picker Buttons ]] Showing the bar dynamicaly, to indicate if any initial selections have been made.
Expand All @@ -498,7 +503,7 @@ - (void) startPicking: (NSArray *)p_pickerOptions andInitial: (NSArray *)p_initi
// make a toolbar
// MM-2012-10-15: [[ Bug 10463 ]] Make the picker scale to the width of the device rather than a hard coded value (fixes issue with landscape iPhone 5 being 568 not 480).
UIToolbar *t_toolbar;
t_toolbar = [[UIToolbar alloc] initWithFrame: (t_is_landscape ? CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . height, 32) : CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . width, 44))];
t_toolbar = [[UIToolbar alloc] initWithFrame: (t_is_landscape ? CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . height, t_landscape_height) : CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . width, t_portrait_height))];
t_toolbar.barStyle = UIBarStyleBlack;
t_toolbar.translucent = YES;
[t_toolbar sizeToFit];
Expand Down Expand Up @@ -546,7 +551,8 @@ - (void) startPicking: (NSArray *)p_pickerOptions andInitial: (NSArray *)p_initi

CGRect t_rect;
uint2 t_offset;
t_offset = 28;
// PM-2015-03-25: [[ Bug 15070 ]] Make the offset scale to the height of the device rather than a hard coded value
t_offset = [[UIScreen mainScreen] bounds] . size . height / 17;

if (!t_is_landscape)
t_rect = CGRectMake(0, [[UIScreen mainScreen] bounds] . size . height / 2 + t_offset, [[UIScreen mainScreen] bounds] . size . width, [[UIScreen mainScreen] bounds] . size . height / 2 - t_offset);
Expand Down
12 changes: 9 additions & 3 deletions engine/src/mbliphonepickdate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,14 @@ - (void) startDatePicker:(NSString *)p_style andCurrent: (int32_t)r_current andS
// compute orientation
bool t_is_landscape;
t_is_landscape = UIInterfaceOrientationIsLandscape(MCIPhoneGetOrientation());

// PM-2015-03-25: [[ Bug 15070 ]] Make the y-pos scale to the height of the device rather than a hard coded value
CGFloat t_portrait_height, t_landscape_height;
t_portrait_height = [[UIScreen mainScreen] bounds] . size . height / 11 ;
t_landscape_height = [[UIScreen mainScreen] bounds] . size . height / 15 ;

// create the pick wheel
datePicker = [[UIDatePicker alloc] initWithFrame: CGRectMake(0, (t_is_landscape ? 32 : 44), 0, 0)];
datePicker = [[UIDatePicker alloc] initWithFrame: CGRectMake(0, (t_is_landscape ? t_landscape_height : t_portrait_height), 0, 0)];

// set the locale
NSLocale *t_locale = [NSLocale currentLocale];
Expand Down Expand Up @@ -276,7 +281,7 @@ - (void) startDatePicker:(NSString *)p_style andCurrent: (int32_t)r_current andS
// make a toolbar
// MM-2012-10-15: [[ Bug 10463 ]] Make the picker scale to the width of the device rather than a hard coded value (fixes issue with landscape iPhone 5 being 568 not 480).
UIToolbar *t_toolbar;
t_toolbar = [[UIToolbar alloc] initWithFrame: (t_is_landscape ? CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . height, 32) : CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . width, 44))];
t_toolbar = [[UIToolbar alloc] initWithFrame: (t_is_landscape ? CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . height, t_landscape_height) : CGRectMake(0, 0, [[UIScreen mainScreen] bounds] . size . width, t_portrait_height))];
t_toolbar.barStyle = UIBarStyleBlack;
t_toolbar.translucent = YES;
[t_toolbar sizeToFit];
Expand Down Expand Up @@ -325,7 +330,8 @@ - (void) startDatePicker:(NSString *)p_style andCurrent: (int32_t)r_current andS

CGRect t_rect;
uint2 t_offset;
t_offset = 28;
// PM-2015-03-25: [[ Bug 15070 ]] Make the offset scale to the height of the device rather than a hard coded value
t_offset = [[UIScreen mainScreen] bounds] . size . height / 17;

if (!t_is_landscape)
t_rect = CGRectMake(0, [[UIScreen mainScreen] bounds] . size . height / 2 + t_offset, [[UIScreen mainScreen] bounds] . size . width, [[UIScreen mainScreen] bounds] . size . height / 2 - t_offset);
Expand Down