Skip to content

Commit

Permalink
fixed a compatibility issue of ActionSheetPicker with pre-iOS7 devices
Browse files Browse the repository at this point in the history
tapDismissAction other than TapActionNone will not work on old devices
  • Loading branch information
kashifhisam committed Apr 14, 2015
1 parent 432de73 commit 4c83f91
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions Pickers/AbstractActionSheetPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -228,25 +228,27 @@ - (void)showActionSheetPicker
[masterView addSubview:_pickerView];
[self presentPickerForView:masterView];

switch (self.tapDismissAction)
{
case TapActionNone:break;
case TapActionSuccess:{
// add tap dismiss action
self.actionSheet.window.userInteractionEnabled = YES;
UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionPickerDone:)];
[self.actionSheet.window addGestureRecognizer:tapAction];
break;
}
case TapActionCancel:{
// add tap dismiss action
self.actionSheet.window.userInteractionEnabled = YES;
UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionPickerCancel:)];
[self.actionSheet.window addGestureRecognizer:tapAction];
break;
}
};

if ([UIViewController instancesRespondToSelector:@selector(edgesForExtendedLayout)]) {
switch (self.tapDismissAction)
{
case TapActionNone:break;
case TapActionSuccess:{
// add tap dismiss action
self.actionSheet.window.userInteractionEnabled = YES;
UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionPickerDone:)];
[self.actionSheet.window addGestureRecognizer:tapAction];
break;
}
case TapActionCancel:{
// add tap dismiss action
self.actionSheet.window.userInteractionEnabled = YES;
UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionPickerCancel:)];
[self.actionSheet.window addGestureRecognizer:tapAction];
break;
}
};
}

}

- (IBAction)actionPickerDone:(id)sender
Expand Down

0 comments on commit 4c83f91

Please sign in to comment.