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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:37:09+00:00 2026-06-05T05:37:09+00:00

I have a UImageView which i have set up in interface builder with a

  • 0

I have a UImageViewwhich i have set up in interface builder with a png (pair of eyes) from my resources. I then want to replace this image (after a specific amount of time) with an animation of eyes blinking.

This is the code i have used which is called in viewWillAppear:

NSString *fileName; 
    NSMutableArray *imageArray = [[NSMutableArray alloc] init];
    for(int i = 1; i < 12; i++) {
        fileName = [NSString stringWithFormat:@"HDBlinkPage1/hd_eyes_blinking%d.png", i];
        [imageArray addObject:[UIImage imageNamed:fileName]];
    }
    imgHDBlink.userInteractionEnabled = YES;
    imgHDBlink.animationImages = imageArray;
    imgHDBlink.animationDuration = 0.9;
    imgHDBlink.animationRepeatCount = 1;
    imgHDBlink.contentMode = UIViewContentModeScaleToFill;
    //[self.view addSubview:imgHDBlink];
    [imgHDBlink startAnimating];

In viewWillAppear I use an NSTimer to trigger the animation every 5 seconds:

[NSTimer scheduledTimerWithTimeInterval:5.0
                                     target:self
                                   selector:@selector(blinkAnimation)
                                   userInfo:nil
                                    repeats:YES];

The problem is, when i run the application i don’t see the initial static image at all. I just see the animation every 5 seconds but no image of the open eyes in between these animations. Can anyone please help me resolve this issue or point me in the right direction? 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-05T05:37:09+00:00Added an answer on June 5, 2026 at 5:37 am

    Add the animation images after 5.0 seconds. From the UIImageView docs:

    The array must contain UIImage objects. You may use the same image object more than once in the array. Setting this property to a value other than nil hides the image represented by the image property. The value of this property is nil by default.

    If you set the animationImages array beforehand, it won’t display the image.

    EDIT:
    (All using ARC)

    - (void) viewDidLoad {
      [super viewDidLoad];
    
      //Initialize self.imgHDBlink
    }
    
    - (void) viewDidAppear: (BOOL) animated {
        [super viewDidAppear: animated];
    
        self.imgHDBlink.image = [UIImage imageNamed: @"static_image"];
    
        [NSTimer scheduledTimerWithTimeInterval: 5.0
                                         target: self
                                       selector: @selector(blinkAnimation:)
                                       userInfo: nil
                                        repeats: YES];
    }
    
    - (void) blinkAnimation: (NSTimer*) timer {
    
        self.imgHDBlink.animationImages = [NSArray array];  //Actually add your images here
        [self.imgHDBlink startAnimating];
    
        [self.imgHDBlink performSelector: @selector(setAnimationImages:) withObject: nil afterDelay: self.imgHDBlink.animationDuration];
    }
    
    
    
    //Remember this to stop crashes if we are dealloced
    - (void) dealloc {
        [NSObject cancelPreviousPerformRequestsWithTarget: self 
                                                 selector: @selector(blinkAnimation:) 
                                                   object: nil];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a UITableViewCell in Interface Builder which I have added a UIImageView and
So I have the following code in a method which I want to set
I want to increase the size of cell image which I have set like
I have a UIImageView which has a png image sequence loaded into it. My
I have a UIScrollView in which I've set the contentSize to the size of
In the interface designer, I have a very simple setup. The main view (which
I already have a custom UIAlertView and in which i want to add UIImageView
I would want to create a custom UITableViewCell which should have a different appearance
I have a custom UIImageView class which I use to handle multi-touch events on
I have a UIScrollView which has an UIImageView in it. I need to be

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.