Skip to content

Commit

Permalink
More UIAlertView fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Zachary Waldowski <zwaldowski@gmail.com>
  • Loading branch information
zwaldowski committed Jan 3, 2012
1 parent f92acae commit 2e04b50
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions BlocksKit/UIAlertView+BlocksKit.m 100755 → 100644
Expand Up @@ -89,9 +89,6 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto
if (block)
block(alertView, buttonIndex);

if (buttonIndex == alertView.cancelButtonIndex)
return;

id key = [NSNumber numberWithInteger:buttonIndex];
BKBlock buttonBlock = [self.handlers objectForKey: key];
if (buttonBlock)
Expand Down Expand Up @@ -135,9 +132,16 @@ + (void) showAlertViewWithTitle: (NSString *) title message: (NSString *) messag
alertView.cancelButtonIndex = [alertView addButtonWithTitle: cancelButtonTitle];

// Set other buttons
[otherButtonTitles each: ^(NSString *button) {
[alertView addButtonWithTitle: button];
}];
if (otherButtonTitles.count)
{
NSUInteger firstOtherButton = [alertView addButtonWithTitle: [otherButtonTitles objectAtIndex: 0]];
[alertView setValue: [NSNumber numberWithInteger: firstOtherButton] forKey: @"firstOtherButton"];

otherButtonTitles = [otherButtonTitles subarrayWithRange: NSMakeRange(1, otherButtonTitles.count - 1)];
[otherButtonTitles each: ^(NSString *button) {
[alertView addButtonWithTitle: button];
}];
}

// Set `didDismissBlock`
if (block) alertView.didDismissBlock = block;
Expand Down

0 comments on commit 2e04b50

Please sign in to comment.