У меня есть код, который, когда пользователь попадает в конец игры, запрашивает его, если он захочет сыграть снова:
-(void)showAlert
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" B U S T E D ! "
message:@"Sorry, you busted!\n\nWant to try your luck 1 More Time! ?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"New Game", nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the OK/Cancel buttons
if (buttonIndex == 0)
{
//here is where we can close it
}
if (buttonIndex == 1)
{
[self createNewGame];
}
}
Теперь я хочу также проверить, когда пользователь впервые запускает приложение, чтобы увидеть, существует ли файл предыдущей игры, и если да, спросить, хотят ли они продолжить. Я знаю, что могу сделать через:
-(void)priorGameExists
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@" Previous Game Exists ! "
message:@"A previous game currently exists. Would you like to resume that game?"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Resumse", nil];
[alert show];
[alert release];
}
Но как мне перейти на новый "пользовательский" clickedButtonAtIndex? Правильно ли я считаю, что это связано с настройкой другого делегата? И если так, как бы я это сделал?