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 823633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:58:42+00:00 2026-05-15T02:58:42+00:00

I have been working on an iphone apps for several weeks. Now I encounter

  • 0

I have been working on an iphone apps for several weeks. Now I encounter an animation problem that I can’t figure out how to resolve. Mayhbe you can help. Here is the details (a little long, bear with me):

Basically the effect I want to achieve is, when user click a button, a loading view pops up, hiding the whole screen; and then the apps does a lot of heavy computation, which takes a few seconds. Once the computation is done, soem result views (something likes checkers on a checker board) are rendered under the loading view. Once all result views are rendered, I used animation animation to remove the loading view nand show the result views to the user.
Here is what I do:

  1. when user click a button, run this code:

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(loadingViewInserted:finished:context:)];
    // use a really high index number so it will always on top
    [self.view insertSubview:loadingViewController.view atIndex:1000];

    [UIView commitAnimations];
    
  2. In the “loadingViewInserted” function, it calls another function doing the heavy computation work.

  3. Once the computation is done, a lot of result views (like checkers on a checker board) are rendered under the loading view.

    for(int colIndex = 1; colIndex <= result.columns; colIndex++) {
        for(int rowIndex = 1; rowIndex <= result.rows; rowIndex++) {
            ResultView *rv = [ResultView resultViewWithData:results[colIndex][rowIndex]];
                [self.view addSubview:rv];
        }
    }
    
  4. Once all result views are added, following animation is invoked to remove the loading view:

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
    [loadingViewController.view removeFromSuperview];
    
    [UIView commitAnimations];
    

By doing this, most of the time (maybe 90%) it does exactly what I want. However, sometime I see some weird result: the loading view shows up first as expected, then before it disappears, some result views, which suppose to be under the loading view, suddenly appears on top of the loading view; and some of them are partial rendered. And then the loading view curled up, and everything looks normal again. The weird situation only lasts for less than a second, but already bad enough to screw up the UI.

I have tried all different kinds of thing to fix this (using another thread to remove the loading view, make the loading view non-transparent), but none of them works. The only thing that makes a little better is, I hide all the result views first; after the last animation finished, in its call back, unhide all result views. But this loses the nice effect that when curling up the loading view, the results are already there.

At this point, I really think this is a bug in iphone (I compile it with OS 3.0) OS. Or maybe you can point out what I have done wrong (or could do differently).

(thanks for finishing this long post, 🙂 )

  • 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-05-15T02:58:42+00:00Added an answer on May 15, 2026 at 2:58 am

    AddSubview is supposed to add the subview on top of its peer views. You probably want insertSubview:belowSubview:

    I’d guess that it “works” sometimes because the computation is stalling the animation, due to CPU contention.

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

Sidebar

Related Questions

I have been working on a wrapper for a COM object that can only
I have an iPhone (Xcode) Project that was working fine. Something must have been
For the past few weeks I have been working on an app that uses
I have been working using openFrameworks, on a problem that is posted on the
I have not been working with Monotouch (or the iphone for that matter) for
I have been working on an object class for my iPhone app that lazy
I have been working with a string[] array in C# that gets returned from
I have been working on some legacy C++ code that uses variable length structures
I have been working as a native C++ programmer for last few years. Now
I'm working on a couple different iphone apps that both record and play sounds

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.