Skip to content
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

Bug fix #60

Merged
merged 2 commits into from
May 27, 2014
Merged
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
11 changes: 9 additions & 2 deletions Pickers/ActionSheetStringPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,14 @@ - (UIView *)configuredPickerView {
UIPickerView *stringPicker = [[[UIPickerView alloc] initWithFrame:pickerFrame] autorelease];
stringPicker.delegate = self;
stringPicker.dataSource = self;
stringPicker.showsSelectionIndicator = YES;
[stringPicker selectRow:self.selectedIndex inComponent:0 animated:NO];
if (self.data.count == 0) {
stringPicker.showsSelectionIndicator = NO;
stringPicker.userInteractionEnabled = NO;
} else {
stringPicker.showsSelectionIndicator = YES;
stringPicker.userInteractionEnabled = YES;
}

//need to keep a reference to the picker so we can clear the DataSource / Delegate when dismissing
self.pickerView = stringPicker;
Expand All @@ -96,7 +102,8 @@ - (UIView *)configuredPickerView {

- (void)notifyTarget:(id)target didSucceedWithAction:(SEL)successAction origin:(id)origin {
if (self.onActionSheetDone) {
_onActionSheetDone(self, self.selectedIndex, [self.data objectAtIndex:self.selectedIndex]);
id selectedObject = (self.data.count > 0) ? [self.data objectAtIndex:self.selectedIndex] : nil;
_onActionSheetDone(self, self.selectedIndex, selectedObject);
return;
}
else if (target && [target respondsToSelector:successAction]) {
Expand Down