Skip to content

Commit

Permalink
Merge pull request #110 from michalciolek/master
Browse files Browse the repository at this point in the history
Fix for #109
  • Loading branch information
skywinder committed Dec 10, 2014
2 parents 3bd3203 + f73db1c commit 5b9fc51
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Pickers/AbstractActionSheetPicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ _Pragma("clang diagnostic pop") \

typedef NS_ENUM(NSInteger, ActionType)
{
Value,
Selector,
Block
ActionTypeValue,
ActionTypeSelector,
ActionTypeBlock
};

typedef void (^ActionBlock)(void);
Expand Down
12 changes: 6 additions & 6 deletions Pickers/AbstractActionSheetPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ - (void)addCustomButtonWithTitle:(NSString *)title value:(id)value
value = @0;
NSDictionary *buttonDetails = @{
kButtonTitle : title,
kActionType : @(Value),
kActionType : @(ActionTypeValue),
kButtonValue : value
};
[self.customButtons addObject:buttonDetails];
Expand All @@ -263,7 +263,7 @@ - (void)addCustomButtonWithTitle:(NSString *)title actionBlock:(ActionBlock)bloc
block = (^{});
NSDictionary *buttonDetails = @{
kButtonTitle : title,
kActionType : @(Block),
kActionType : @(ActionTypeBlock),
kButtonValue : [block copy]
};
[self.customButtons addObject:buttonDetails];
Expand All @@ -277,7 +277,7 @@ - (void)addCustomButtonWithTitle:(NSString *)title target:(id)target selector:(S
target = [NSNull null];
NSDictionary *buttonDetails = @{
kButtonTitle : title,
kActionType : @(Selector),
kActionType : @(ActionTypeSelector),
kActionTarget: target,
kButtonValue : [NSValue valueWithPointer:selector]
};
Expand All @@ -295,7 +295,7 @@ - (IBAction)customButtonPressed:(id)sender

ActionType actionType = (ActionType) [buttonDetails[kActionType] integerValue];
switch (actionType) {
case Value: {
case ActionTypeValue: {
NSAssert([self.pickerView respondsToSelector:@
selector(selectRow:inComponent:animated:)], @"customButtonPressed not overridden, cannot interact with subclassed pickerView");
NSInteger buttonValue = [buttonDetails[kButtonValue] integerValue];
Expand All @@ -310,15 +310,15 @@ - (IBAction)customButtonPressed:(id)sender
break;
}

case Block: {
case ActionTypeBlock: {
ActionBlock actionBlock = buttonDetails[kButtonValue];
[self dismissPicker];
if (actionBlock)
actionBlock();
break;
}

case Selector: {
case ActionTypeSelector: {
SEL selector = [buttonDetails[kButtonValue] pointerValue];
id target = buttonDetails[kActionTarget];
[self dismissPicker];
Expand Down
6 changes: 3 additions & 3 deletions Pickers/ActionSheetDatePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ - (void)customButtonPressed:(id)sender {

ActionType actionType = (ActionType) [buttonDetails[kActionType] integerValue];
switch (actionType) {
case Value: {
case ActionTypeValue: {
NSAssert([self.pickerView respondsToSelector:@selector(setDate:animated:)], @"Bad pickerView for ActionSheetDatePicker, doesn't respond to setDate:animated:");
NSDate *itemValue = buttonDetails[kButtonValue];
UIDatePicker *picker = (UIDatePicker *)self.pickerView;
Expand All @@ -250,8 +250,8 @@ - (void)customButtonPressed:(id)sender {
break;
}

case Block:
case Selector:
case ActionTypeBlock:
case ActionTypeSelector:
[super customButtonPressed:sender];
break;

Expand Down
6 changes: 3 additions & 3 deletions Pickers/ActionSheetLocalePicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ - (void)customButtonPressed:(id)sender {

ActionType actionType = (ActionType) [buttonDetails[kActionType] intValue];
switch (actionType) {
case Value: {
case ActionTypeValue: {
id itemValue = buttonDetails[kButtonValue];
if ( [itemValue isKindOfClass:[NSTimeZone class]] )
{
Expand All @@ -392,8 +392,8 @@ - (void)customButtonPressed:(id)sender {
break;
}

case Block:
case Selector:
case ActionTypeBlock:
case ActionTypeSelector:
[super customButtonPressed:sender];
break;
default:
Expand Down

0 comments on commit 5b9fc51

Please sign in to comment.