Closed karlvr closed 10 years ago
Yeah you're right, first other button index will be -1, and a cancel will be at 0.
The following causes a crash!
[UIAlertView showWithTitle:@"Title"
message:@"Message"
cancelButtonTitle:@"cancel"
otherButtonTitles:@[@"one", @"two"]
tapBlock:^(UIAlertView *alertView, NSInteger buttonIndex){
NSLog(@"%@", [alertView buttonTitleAtIndex:alertView.firstOtherButtonIndex]);
}];
I like your sneaky workaround!
...s firstOtherButtonIndex isn't set correctly!
So I've modified the creation of the UIAlertView so it passes the first other button title and then adds any additional ones separately.