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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:21:27+00:00 2026-05-20T17:21:27+00:00

I have a animation (an array of images) that I put in viewDidLoad because

  • 0

I have a animation (an array of images) that I put in viewDidLoad because I want it to play right after it starts. After the animation in viewDidLoad I also show a webview in an UIWebView which I’d like to stay. The animation plays (for some reason not the UIImage I created) but I can’t get rid of it after completion. I’ve tried putting in a timer and removing the animation from the superview but instead of removing it, it exits the app and goes back to the main page.

-(void)viewDidLoad
{
    UIImage *first = [UIImage imageNamed:@"panda1.png"];
    animation = [[UIImageView alloc] initWithImage:first];
    animation.animationImages = [NSArray arrayWithObjects: first,
                                     [UIImage imageNamed:@"panda2.png"], 
                                     [UIImage imageNamed:@"panda3.png"], nil];

    animation.animationRepeatCount = 4;
    animation.animationDuration = 2;
    [animation startAnimating];

    [self.view addSubview:animation];

    //set timer to remove animation from view
    NSTimer *timer;
    timer =  [NSTimer scheduledTimerWithTimeInterval: 3
                          target: self
                        selector: @selector(removeAnimation:)
                        userInfo: nil
                         repeats: NO];

  //for loading the image at start up
  NSString *urlAddress = @"http://projects.seng.uvic.ca/most_recent.php";
  NSURL *url = [NSURL URLWithString:urlAddress];
  NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

  //load the request in the UIWebView
  [webView loadRequest:requestObj];

}

//removes the animation from subview
- (void) method: (NSTimer*) theTimer
{
   [animation release];
   [animation removeFromSuperview];
}
  • 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-20T17:21:28+00:00Added an answer on May 20, 2026 at 5:21 pm

    It looks like the selector you are choosing (removeAnimation:) and the method you are showing (method:) are not named the same.

    An easier approach would be to do something like this:

    -(void)viewDidLoad
    {
        UIImage *first = [UIImage imageNamed:@"panda1.png"];
        animation = [[UIImageView alloc] initWithImage:first];
        animation.animationImages = [NSArray arrayWithObjects: first,
                                         [UIImage imageNamed:@"panda2.png"], 
                                         [UIImage imageNamed:@"panda3.png"], nil];
    
        animation.animationRepeatCount = 4;
        animation.animationDuration = 2;
        [animation startAnimating];
    
        [self.view addSubview:animation];
        [self performSelector:@selector(removeAnimation) withObject:nil afterDelay:8.0];
    
    
        //for loading the image at start up
        NSString *urlAddress = @"http://projects.seng.uvic.ca/most_recent.php";
        NSURL *url = [NSURL URLWithString:urlAddress];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    
        //load the request in the UIWebView
        [webView loadRequest:requestObj];
    }
    
    - (void)removeAnimation
    {
        [animation removeFromSuperview];
        [animation release];
    }
    

    Hello, I’m a Panda.

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

Sidebar

Related Questions

If I have an animation which can play with an array of images. How
I have an animation and I want it to play it just only once.
I have a menu with an animation going on, but I want to disable
I have a Flex App that allows you to dynamically build an animation. It
I have a storyboard(1) that does some basic animations in 2 seconds. I want
I have an array randomAlphabets which contains CCSprite objects. I need to start animation
I have an array randomAlphabets which contains CCSprite objects. I need to start animation
I want to animate through an array of CATextLayers, one after the other. The
I have a .net winforms app which has a few animation effects, fade ins
I have an image that is animating, until you press the button that says

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.