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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:25:27+00:00 2026-06-07T00:25:27+00:00

Basically, I have a UIImageView that will loop through 8 PNGs over 0.5 seconds.

  • 0

Basically, I have a UIImageView that will loop through 8 PNGs over 0.5 seconds. At the same time I start the animation, I do a performSelector with afterDelay of 0.5 seconds. So after my UIImageView has finished animating it will call animationTickDone which will set the last image hidden to no.

Here’s the code anyway:

.h
@interface ViewController : UIViewController{
    IBOutlet UIView *scannedView;
    IBOutlet UIImageView *animatedTickLast;
}
@property (nonatomic, retain) IBOutlet UIView *scannedView;
@property (nonatomic, retain) IBOutlet UIImageView *animatedTickLast;

.m
-(void)Found{
        [self.view addSubview:scannedView];
        [animatedTickLast setHidden:YES];
        //place animated tick images into an array
        NSMutableArray *animatedTickImages;
        animatedTickImages = [[NSMutableArray alloc] init];
        NSUInteger nimages = 0;
        for (nimages=0; nimages<8; nimages++){
            NSString *tickImageName = [NSString stringWithFormat:@"tick_%d.png", (nimages + 1)];
            [animatedTickImages addObject:[UIImage imageNamed:tickImageName]];
        }
        //set up animated tick
        UIImageView *animatedTick = [[UIImageView alloc] initWithFrame:CGRectMake(98, 213, 125, 90)];
        [animatedTick setAnimationImages:animatedTickImages];
        [animatedTick setAnimationDuration:0.5];
        [animatedTick setAnimationRepeatCount:1];
        [animatedTick startAnimating];
        NSLog(@"animation started");
        [self performSelector:@selector(animationTickDone) withObject:nil afterDelay:0.5];
        [scannedView addSubview:animatedTick];
        NSLog(@"animation added into view");
        [animatedTickImages release];
}
- (void)animationTickDone{
    NSLog(@"delay function begins");
    [animatedTickLast setHidden:NO];
    sleep(1); //sleep so that scannedView stays on screen for at least 1.5 seconds (0.5 after animation + 1 from sleep);
}

Now, the problem. The animation itself is fine, and works great. But when Found() is first called, animatedTickLast will become visible after the animation. But when ever Found is called again afterwords, animatedTickDone never appears again, it’s just an empty space.

After hours looking around the web searching and playing with it, I just cannot understand what the issue is as to why it doesn’t appear. I thought at one point sleep() was getting called before my animatedTickLast could get chance to set hidden to no, but after removing sleep() it still didn’t work.

Driving me nuts now so any help is greatly appreciated.

Thanks!

  • 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-07T00:25:28+00:00Added an answer on June 7, 2026 at 12:25 am

    If I understand you correctly you want an image after the animaton in the UIImageView. Just set the image before the animation and you are fine!

    [animatedTick setAnimationImages:animatedTickImages];
    [animatedTick setAnimationDuration:0.5];
    [animatedTick setAnimationRepeatCount:1];
    [animatedTick setImage:theImageYouLikeToHave];
    [animatedTick startAnimating];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I basically have a web-browser control that is going through and automatically completing some
I have 2 Databases that basically have the same structure, but different data. (The
I basically have 7 select statements that I need to have the results output
I basically have the same question as this guy .. The example in the
I have this error that is keeping me from moving forward. I basically have
To describe my project: I have a rectangle UIImageView frame floating over a white
I have my NSTimer embedded in a class that plays image sequences. Basically it
Basically, I want to have an app with only one view that has an
My issue is basically the the same as this one . I have a
I basically have the same issue as this question: Embed multiple icons in WPF

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.