Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:53:37+00:00 2026-06-13T07:53:37+00:00

I have a very simple process running where after each round of a simple

  • 0

I have a very simple process running where after each round of a simple game the scores are calculated, labels updated and all the normal, very simple stuff. I have a UIAlertView that informs the player of how s/he performed. I use a UIAlertViewDelegate to postpone all the updates, resetting of controls etc. till after the UIAlertView is dismissed. The methods are [startNewRound],[startOver] and [updateLabels]. It’s fairly obvious what they all do. Anyway, when the user hits round ten, I’ve made another UIAlertView that informs the player that the game has ended and shows the overall score. Again, I hoped to use a delegate to postpone the resets till after the AlertView is dismissed. The only problem is, with the endGame AlertView, it seems to be using the first AlertView’s delegate method causing the game to continue with a new round and not start from the beginning. I hope this makes sense. Anyway, here are snippets of my code.

if (round == 10){
    UIAlertView *endGame = [[UIAlertView alloc]
                            initWithTitle: @"End of Game"
                            message: endMessage
                            delegate:self
                            cancelButtonTitle:@"New Game"
                            otherButtonTitles:nil];
    [endGame show];
}
else {
    UIAlertView *alertView = [[UIAlertView alloc]
                          initWithTitle: title
                          message: message
                          delegate:self
                          cancelButtonTitle:@"Next"
                          otherButtonTitles:nil];

    [alertView show];
}

And then the delegate methods:

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    [self startNewRound];
    [self updateLabels];
}

- (void)endGame:(UIAlertView *)endGame didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    [self startOver];
}

So there it is. As I mentioned, the endGame AlertView appears to be using alertView’s delegate, thus not activating the [self startOver] method. All the methods are working, it’s just the AlertView is using the incorrect delegate method.

Regards,
Mike

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:53:38+00:00Added an answer on June 13, 2026 at 7:53 am

    Change your code like this,

        if (round == 10){
            UIAlertView *endGame = [[UIAlertView alloc]
                                    initWithTitle: @"End of Game"
                                    message: endMessage
                                    delegate:self
                                    cancelButtonTitle:@"New Game"
                                    otherButtonTitles:nil];
            endGame.tag = 111;
            [endGame show];
        }
        else {
            UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle: title
                                  message: message
                                  delegate:self
                                  cancelButtonTitle:@"Next"
                                  otherButtonTitles:nil];
            alertView.tag = 222;
            [alertView show];
        }
    

    and delegate method as,

    - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
        {
            if(alertView.tag == 111)
            {
                [self startNewRound];
                [self updateLabels];
            }
            else if(alertView.tag == 222)
            {
                [self startOver];
    
            }
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have what may be a very simple question. I want to process a
I have very simple piece of code. The goal is when i input four-digit
I have very simple OpenGL ES example similar to Hehe's example : http://nehe.gamedev.net/tutorial/ios_lesson_02__first_triangle/50001/ As
I have very simple window where I have 2 buttons - one for cancel,
I have a very simple table called Member , which consists of the following:
I have a very simple fxml file, with a checkbox: ... <AnchorPane id=AnchorPane xmlns:fx=http://javafx.com/fxml
I have a very simple Mapping I'm trying to do. I'm following the NHibernate
I have a very simple script that creates a user: <?php include 'mysqlserver.php'; session_start();
I have this very simple jQuery function: $(.milestone-in-tree).live({ mouseenter: function() { setTimeout( $.ajax({ type:
I have a very simple highcharts js chart, which has dates on x-axis and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.