From 63e65a81b4e8bffdbe7b7f8a604a4430abe002c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Feij=C3=B3?= Date: Wed, 21 May 2014 09:25:35 -0300 Subject: [PATCH] Avoid background tap --- BSModalPickerView/BSModalPickerView.h | 2 ++ BSModalPickerView/BSModalPickerView.m | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/BSModalPickerView/BSModalPickerView.h b/BSModalPickerView/BSModalPickerView.h index 834443b..d54f68a 100644 --- a/BSModalPickerView/BSModalPickerView.h +++ b/BSModalPickerView/BSModalPickerView.h @@ -14,10 +14,12 @@ @property (nonatomic) NSUInteger selectedIndex; @property (nonatomic, strong) NSString *selectedValue; @property (nonatomic, strong) NSArray *values; +@property (nonatomic, assign) BOOL avoidBackdropTap; /* Initializes a new instance of the picker with the values to present to the user. (Note: call presentInView:withBlock: or presentInWindowWithBlock: to display the control) */ - (id)initWithValues:(NSArray *)values; +- (void)onBackdropTap:(id)sender; @end diff --git a/BSModalPickerView/BSModalPickerView.m b/BSModalPickerView/BSModalPickerView.m index 716d46c..a649e63 100644 --- a/BSModalPickerView/BSModalPickerView.m +++ b/BSModalPickerView/BSModalPickerView.m @@ -78,6 +78,12 @@ - (void)onDone:(id)sender { [super onDone:sender]; } +- (void)onBackdropTap:(id)sender +{ + if (_avoidBackdropTap) + [super onBackdropTap:sender]; +} + #pragma mark - Picker View Data Source - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {