Я хочу проверить, если пользователь нажимает «да», например, я хочу поставить определенное действие.Как проверить возвращаемое значение UIAlertView?
Это моя строка кода:
UIAlertView* mes=[[UIAlertView alloc] initWithTitle:@"Are you sure?" message:@"this will start a new game" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[mes show];
Так что я хочу сказать if user tap "yes" preform this action
это мой метод: Я хочу сказать, если пользователь нажмет «да» создать новую игру.
- (IBAction)newGame:(UIButton *)sender {
UIAlertView* mes=[[UIAlertView alloc] initWithTitle:@"Are you sure?" message:@"this will start a new game" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[mes show];
self.flipsCount = 0;
self.game = nil;
for (UIButton *button in self.cardButtons) {
Card *card = [self.game cardAtIndex:[self.cardButtons indexOfObject:button]];
card.unplayble = NO;
card.faceUp = NO;
button.alpha = 1;
}
self.notificationLabel.text = nil;
[self updateUI];
}
http://stackoverflow.com/questions/3826659/uialertview-delegates –