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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:05:11+00:00 2026-05-26T08:05:11+00:00

I have 10 UILabels , maybe some UIImageViews . I want to display all

  • 0

I have 10 UILabels, maybe some UIImageViews. I want to display all these in 1 UIView with smooth FadeOut & FadeIn transition, one after the other.

I know putting UIView animations in a for-loop will not work as animations are done asynchronous & will not give proper effect. So the way normally I would do this is to chain UIView animation together. i.e. after one elements animation is complete begin the next one. For 3-4 elements the code looks ok. Like so –

[UIView animateWithDuration:0.25 
                      delay:0 
                    options:UIViewAnimationCurveEaseInOut 
                 animations:^{ //do something with alpha here - first element } 
                 completion:^(BOOL finished){ 
                     [UIView animateWithDuration:0.25 
                             delay:0 
                             options:UIViewAnimationCurveEaseInOut 
                             animations:^{ //do something with alpha here - 2nd element} 
                                      completion:^(BOOL finished){ ... }

                 }

But for 10+ elements it gets very messy. How would one go about doing this? Essentially I am creating a UIView with looping content, much like a widget.

  • 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-26T08:05:11+00:00Added an answer on May 26, 2026 at 8:05 am

    Edited with NSTimer instead of a loop.

    counter is an ivar defined in the header.

     - (void)viewDidLoad
    {
        [super viewDidLoad];
        counter = 0;
        [NSTimer scheduledTimerWithTimeInterval:0.30
                                         target:self
                                       selector:@selector(timerTick:)
                                       userInfo:nil
                                        repeats:YES];
    }
    
    - (void) timerTick:(NSTimer *)timer{
    
        UIView *currentView = [self.view.subviews objectAtIndex:counter];
        [UIView animateWithDuration:0.25 
                              delay:0 
                            options:UIViewAnimationCurveEaseInOut 
                         animations:^{ currentView.alpha = 1.0;}
                         completion:^(BOOL finished){
                             [UIView animateWithDuration:0.25 animations:^{currentView.alpha = 0.0;}];
                         }
        ];
        counter++;
        if (counter >= [self.view.subviews count]) {
            counter = 0;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several UILabels of various sizes on my Views. I want all the
I have a NIB with a UIView that contains some UILabels, UIButtons etc. and
I have two UILabels. that I want to overlap one atop the other. Call
I have these Views on which I add UILabels as text, The Views can
I have a UItableview with cells. Some cells have uilabels and some have uibuttons.
I have three UILabels. I want to detect which label is Tapped, and then
I have a UITable containing some customs UITableCells. Those cells contain a few UILabels
I have UILabels animating on my mainView and I want to have a custom
I have two UILabels in a view that display my band and song name
I have an app that I want to change the UILabels sizes without changing

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.