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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:04:14+00:00 2026-05-30T17:04:14+00:00

I have an NSArray of strings that I would like to animate with a

  • 0

I have an NSArray of strings that I would like to animate with a simple fade in/out animation.

----------------------------------------------------------------------------------
|     fade in
|     String 1 ---> displayed in UILabel
|     fade out
----------------------------------------------------------------------------------

followed by

----------------------------------------------------------------------------------
|     fade in
|     String 2
|     fade out
----------------------------------------------------------------------------------

etc…

Each one holding it’s position for about 5 seconds before it continues to the next item in the array. I’m not sure where to start… I know how to perform animations but I’m not quite sure how to animate through an array of strings with a 5 second (non-thread-blocking) pause on each iteration. Any ideas?

UPDATE MY SOLUTION BASED ON ACCEPTED ANSWER

- (void)startTimer {
    arrayIndex = 0;

    NSArray *myarray = [alerts_dict allValues]; 
    breakingLabel.text = [myarray objectAtIndex:frameCount];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView setAnimationDuration:1];
    breakingLabel.alpha = 1;
    [UIView commitAnimations];

    arrayIndex++;
    pauseTimer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(myFunction) userInfo:nil repeats:YES];
}

- (void)myFunction {    

   [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^() {
       breakingLabel.alpha = 0;
   }
   completion:^(BOOL finished) {
       NSArray *myarray = [alerts_dict allValues]; 

       if (arrayIndex == [myarray count])
           arrayIndex = 0;

       breakingLabel.text = [myarray objectAtIndex:arrayIndex];

       arrayIndex++;

       [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^() {
           breakingLabel.alpha = 1;
       } completion:nil];
   }];
}
  • 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-30T17:04:16+00:00Added an answer on May 30, 2026 at 5:04 pm

    You can do this pretty easily using block animations:

    1. Animate label’s alpha down to 0.0
    2. On completion: set its text to the new string and animate it’s alpha back to 1.0 (or original value, whatever it was)

    This routine can be invoked repeatedly by an NSTimer timeout callback. Just instantiate a timer with interval 5.0, specify the callback and schedule it to run in the run loop like this:

    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0 target:self
                      selector:@selector(timerFired:) userInfo:nil repeats:YES];
    
    (...)
    
    - (void)timerFired:(NSTimer *)timer
    {
        // call the method to update the label with the next string in the array
        // or invalidate the timer if you've reached the end of array
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an NSArray and need to filter out any strings that are null
I have an NSArray of Foos in an Objective-C program. I would like to
I have an NSArray of NSDictionary objects which I would like to be able
I would like to search through my NSArray for a certain string. Example: NSArray
I have NSArray and I want to remove duplicates from it. I know that
I have an NSArray and I'd like to create a new NSArray with objects
I have an NSArray of (Product) objects that are created by parsing an XML
I have an NSArray which contains NSDictionary objects with keys that are NSNumber objects.
I have an array named 'names' with strings looking like this: [name_23_something, name_25_something, name_2_something];
I have an NSArray of strings and I want to add a certain amount

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.