-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-24574] iOS: Fix picker-selection #8958
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,24 +71,25 @@ -(UIControl*)picker | |
if ([shouldSize numberFromString:widthString] != nil) { | ||
[[self proxy ]setValue:NUMDOUBLE(width) forKey:@"width"]; | ||
} | ||
|
||
if ([shouldSize numberFromString:heightString] != nil) { | ||
[[self proxy ]setValue:NUMDOUBLE(height) forKey:@"height"]; | ||
} | ||
|
||
if (type == -1) | ||
{ | ||
//TODO: this is not the way to abstract pickers, note the cast I had to add to the following line | ||
picker = (UIControl*)[[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; | ||
((UIPickerView*)picker).delegate = self; | ||
((UIPickerView*)picker).dataSource = self; | ||
} | ||
else | ||
{ | ||
if (type == -1) { | ||
picker = (UIControl *)[[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, width, height)]; | ||
[((UIPickerView *) picker) setDelegate:self]; | ||
[((UIPickerView *) picker) setDataSource:self]; | ||
|
||
// Required hack for iOS 10.x (TIMOB-24574), remove when Apple fixes it. | ||
[(UIPickerView *) picker selectRow:0 inComponent:0 animated:YES]; | ||
} else { | ||
picker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, width, height)]; | ||
[(UIDatePicker*)picker setTimeZone:[NSTimeZone localTimeZone]]; | ||
[(UIDatePicker*)picker setDatePickerMode:type]; | ||
[(UIDatePicker *)picker setTimeZone:[NSTimeZone localTimeZone]]; | ||
[(UIDatePicker *)picker setDatePickerMode:type]; | ||
[picker addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged]; | ||
} | ||
|
||
[picker setBackgroundColor:[UIColor whiteColor]]; | ||
[self addSubview:picker]; | ||
} | ||
|
@@ -190,19 +191,6 @@ -(void)setType_:(id)type_ | |
} | ||
} | ||
|
||
// We're order-dependent on type being set first, so we need to make sure that anything that relies | ||
// on whether or not this is a date picker needs to be set AFTER the initial configuration. | ||
-(void)setSelectionIndicator_:(id)value | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather deleting the method , we should deprecate it by giving message to developers. What you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was not used since iOS 7 anyway, so I decided to clean up the core directly. Having it or not does not have an effect to the developer - they cannot disable the selection indicator anyway. |
||
{ | ||
if (picker == nil) { | ||
[[self proxy] replaceValue:value forKey:@"selectionIndicator" notification:NO]; | ||
} | ||
else if ([self isDatePicker]==NO) | ||
{ | ||
[(UIPickerView*)[self picker] setShowsSelectionIndicator:[TiUtils boolValue:value]]; | ||
} | ||
} | ||
|
||
-(void)setMinDate_:(id)date | ||
{ | ||
ENSURE_SINGLE_ARG_OR_NIL(date,NSDate); | ||
|
@@ -471,4 +459,4 @@ -(void)valueChanged:(id)sender | |
|
||
@end | ||
|
||
#endif | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is deprecated in iOS only. So iOS should be mentioned in above line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was written in the iOS-paragraph, so I hoped people will get it's iOS related, but I'll explicitly say it :-).