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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:26:23+00:00 2026-05-24T20:26:23+00:00

I have an iOS app in which every time the view is loaded, all

  • 0

I have an iOS app in which every time the view is loaded, all of the objects in the view quickly fade in.

In my code, I have a

- (void)fadeInEverything

function, and within this function, I call five different functions, with an NSTimer on each of them, so that the objects fade in sequentially, like this:

[self fadeInLabel];


[NSTimer scheduledTimerWithTimeInterval:0.2
                                 target:self
                               selector:@selector(fadeInTextField)
                               userInfo:nil
                                repeats:NO];
[NSTimer scheduledTimerWithTimeInterval:0.4
                                 target:self
                               selector:@selector(fadeInButton)
                               userInfo:nil
                                repeats:NO];
[NSTimer scheduledTimerWithTimeInterval:0.6
                                 target:self
                               selector:@selector(fadeInTextView)
                               userInfo:nil
                                repeats:NO];
[NSTimer scheduledTimerWithTimeInterval:0.8
                                 target:self
                               selector:@selector(fadeInFlipsideViewButton)
                               userInfo:nil
                                repeats:NO];

I have a function that looks like this for each object:

- (void)fadeInTextView
{
    [resultView setAlpha:0];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];

    [resultView setAlpha:1];

    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
    [UIView commitAnimations];
}

My question is, would there we a way to make one function that would take a parameter (the object) and fade it in, so I don’t have to have five almost identical functions? It would save me a lot of space and clutter.

  • 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-24T20:26:24+00:00Added an answer on May 24, 2026 at 8:26 pm

    You could pass your object by reference to accomplish that:

    -(void)fadeInView:(UIView **)aView { // the ** indicates that this method is expecting a reference
        // your fading code
        // this works, because all view's (UILabels, UITextFields etc. inherit UIView. 
    }
    

    And the calling method could look like this:

    -(void)callFader {
        [self fadeInView:&mytextView]; // make sure to put the & before the variable so that it's sent as a reference
        // and more fadeInView calls...    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built an iOS app which I would now like to test converting
I want to add code to my iOS app which prompts users to follow
In my iOS application I have a set of singleton objects which are created
Since the iOS 5 Betas I have been testing my app's code and the
I have created an iOS 4.0 app with a Settings bundle. I am using
I'm developing a web app for iOS devices, and want to have a header
I have a UIWebView which loads videos from an external server. The code seems
I'm writing an iOS app which needs to generate and animate individual text characters
I have an iPhone app which I need to test in an older version
So I have just managed to build a timer on my iOS app I'm

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.