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

  • SEARCH
  • Home
  • 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 9203599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:30:30+00:00 2026-06-17T23:30:30+00:00

I’m transitioning between my game’s main menu and the game itself, and am in

  • 0

I’m transitioning between my game’s main menu and the game itself, and am in need of a loading screen. The current behavior is that I tap the Play button, and there’s no movement and no segue for a few seconds, then the game begins.

Temporarily, I’m just throwing up a UIActivityIndicatorView and manually telling it to startAnimating, then calling the segue to the other scene. The issue is that code from the game view (the end-point of the segue) is being run before the view has physically changed on-screen (i.e. I’m seeing the menu while code from the game is being executed). I don’t quite see how this happens, since the spinner is told to display before the segue is called. Here’s the code:

- (IBAction) startGame: (id) sender
{
    [_loadingView setHidden: NO];
    [_loadingSpinner startAnimating];
    [self performSegueWithIdentifier: @"PlayGame" sender: self];
}

The stuff that’s actually taking the time isn’t called until the segue has completed (i.e. until the game’s main view is shown onscreen in an entirely different ViewController (it’s querying an SQLite database)), so why is the spinner not showing until after that work has been done? Should I be using GCD or similar for this? I’ve done a little experimenting with it but it might be a tad above my level at present. The heavy code is contained in one method, so I’d ideally like to be able to do something like this, literally executing the lines in order.

[spinner startAnimating];
[self callMethodThatTakesAges];
[spinner stopAnimating];

I’ve tried using performSelectorOnMainThread:withObject:waitUntilDone:, but it seems to be getting confused between the two views. The spinner should show on the game view, not the menu view, ideally, so I should tap Play, the transition to the game view should be instant, then the spinner should appear, loading should start, spinner should vanish when done.

Any ideas? Thanks!

EDIT: Here are some methods from my game view controller (makeNewWord is the troublesome method).

- (void) viewDidAppear: (BOOL) animated
{
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle: UIActivityIndicatorViewStyleWhiteLarge];
    [spinner setCenter: CGPointMake(240, 55)];
    [self.view addSubview: spinner];
    [spinner startAnimating];
    [self makeNewWord];
    [spinner stopAnimating];
    [self becomeFirstResponder];

}

- (void) viewDidLoad
{
    [super viewDidLoad];
    [self canBecomeFirstResponder];

    firstLetterMultiplierLetter = [[NSString alloc] init];
    userIsEnteringAWord = NO;

    [self setUpGestures];
}

Here’s the method called from my main menu view that segues into the game view:

- (IBAction) startGame: (id) sender
{
    [self performSegueWithIdentifier: @"PlayGame" sender: self];
}
  • 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-17T23:30:32+00:00Added an answer on June 17, 2026 at 11:30 pm

    It’s hard to tell what you have where from your question. I would say you want to do this:

    1) add the spinner to the game view 
    2) in game view viewDidAppear, have [spinner startAnimating];
    3) call [self methodThatTakesAges] (as the next line in viewDidAppear).
    4) call [spinner stopAnimating] from whatever call back method you have in methodThatTakesAges
    

    The only thing in your startGame: method should be the performSegue line. You might also need to change where you start the download to where I said, it’s not clear where you’re starting that now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters

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.