@@ -120,6 +120,14 @@ + (void)load {
120
120
+ (void ) showAlertViewWithTitle : (NSString *) title message : (NSString *) message cancelButtonTitle : (NSString *) cancelButtonTitle otherButtonTitles : (NSArray *) otherButtonTitles handler : (void (^)(UIAlertView *, NSInteger )) block
121
121
{
122
122
UIAlertView *alertView = [[self class ] alertViewWithTitle: title message: message];
123
+
124
+ // If no buttons were specified, cancel button becomes "Dismiss"
125
+ if (!cancelButtonTitle.length && !otherButtonTitles.count )
126
+ cancelButtonTitle = NSLocalizedString(@" Dismiss" , nil );
127
+
128
+ // Set cancel button
129
+ if (cancelButtonTitle.length )
130
+ alertView.cancelButtonIndex = [alertView addButtonWithTitle: cancelButtonTitle];
123
131
124
132
// Set other buttons
125
133
if (otherButtonTitles.count )
@@ -133,13 +141,13 @@ + (void) showAlertViewWithTitle: (NSString *) title message: (NSString *) messag
133
141
}];
134
142
}
135
143
136
- // If no buttons were specified, cancel button becomes "Dismiss"
137
- if (!cancelButtonTitle.length && !otherButtonTitles.count )
138
- cancelButtonTitle = NSLocalizedString(@" Dismiss" , nil );
139
-
140
- // Set cancel button
141
- if (cancelButtonTitle.length )
142
- alertView.cancelButtonIndex = [alertView addButtonWithTitle: cancelButtonTitle];
144
+ // // If no buttons were specified, cancel button becomes "Dismiss"
145
+ // if (!cancelButtonTitle.length && !otherButtonTitles.count)
146
+ // cancelButtonTitle = NSLocalizedString(@"Dismiss", nil);
147
+ //
148
+ // // Set cancel button
149
+ // if (cancelButtonTitle.length)
150
+ // alertView.cancelButtonIndex = [alertView addButtonWithTitle: cancelButtonTitle];
143
151
144
152
// Set `didDismissBlock`
145
153
if (block) alertView.didDismissBlock = block;
0 commit comments