- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated{
if (0 == [alerts cancelButtonIndex]) {
NSLog(@"YES");
} else if (1 == [alerts cancelButtonIndex]) {
NSLog(@"NO");
}
alerts = [[UIAlertView alloc] initWithTitle:@"Trumpets" message:@"Are you sure you would like to use one trumpet, this will give you 10 random units" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alerts show];
最佳答案
您错过了结尾括号:
- (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated{
if ([alerts cancelButtonIndex] == 0) {
NSLog(@"YES");
} else if ([alerts cancelButtonIndex] == 1) {
NSLog(@"NO");
}
}
关于objective-c - UIAlertView dismissWithClickedButtonIndex :animated: method error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8001833/