File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,28 +119,17 @@ + (void)load {
119119
120120+ (void ) showAlertViewWithTitle : (NSString *) title message : (NSString *) message cancelButtonTitle : (NSString *) cancelButtonTitle otherButtonTitles : (NSArray *) otherButtonTitles handler : (void (^)(UIAlertView *, NSInteger )) block
121121{
122- UIAlertView *alertView = [[self class ] alertViewWithTitle: title message: message];
123-
124- // Set other buttons
125- if (otherButtonTitles.count )
126- {
127- NSUInteger firstOtherButton = [alertView addButtonWithTitle: otherButtonTitles[0 ]];
128- [alertView setValue: @(firstOtherButton) forKey: @" firstOtherButton" ];
129-
130- otherButtonTitles = [otherButtonTitles subarrayWithRange: NSMakeRange (1 , otherButtonTitles.count - 1 )];
131- [otherButtonTitles each: ^(NSString *button) {
132- [alertView addButtonWithTitle: button];
133- }];
134- }
135-
136122 // If no buttons were specified, cancel button becomes "Dismiss"
137123 if (!cancelButtonTitle.length && !otherButtonTitles.count )
138124 cancelButtonTitle = NSLocalizedString(@" Dismiss" , nil );
139125
140- // Set cancel button
141- if (cancelButtonTitle.length )
142- alertView.cancelButtonIndex = [alertView addButtonWithTitle: cancelButtonTitle];
143-
126+ UIAlertView *alertView = [[[self class ] alloc ] initWithTitle: title message: message delegate: self .dynamicDelegate cancelButtonTitle: cancelButtonTitle otherButtonTitles: nil ];
127+
128+ // Set other buttons
129+ [otherButtonTitles each: ^(NSString *button) {
130+ [alertView addButtonWithTitle: button];
131+ }];
132+
144133 // Set `didDismissBlock`
145134 if (block) alertView.didDismissBlock = block;
146135
You can’t perform that action at this time.
0 commit comments