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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:12:31+00:00 2026-06-15T02:12:31+00:00

I wrote a custom UITableViewCell – image view, button and three labels now I

  • 0

I wrote a custom UITableViewCell – image view, button and three labels now I am trying to add some animations to it. So once I tap the button, it fades away and the spinner replaces the button. After two seconds the cell is overlaid with a red color, as a subview of cell fades in, then the indicator is removed and and red overlay starts fading back out. As well the button I previously removed fades back in.

(I could not phrase it a better way 😛 )

The method is :

-(void)rentButtonPressed:(id)sender
{

    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    [indicator startAnimating];
    indicator.center = self.rentButton.center;

    [UIView animateWithDuration:0.2
                     animations:^{self.rentButton.alpha = 0.0;}
                     completion:^(BOOL finished){
                         [self.rentButton removeFromSuperview];
                         [self addSubview:indicator];
                     }
     ];

    UIView *overlay = [[UIView alloc] initWithFrame:self.backgroundImage.frame];
    overlay.alpha = 0.0;
    overlay.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:overlay];

    [UIView animateWithDuration:0.4
                          delay:2.0
                        options:UIViewAnimationCurveEaseInOut
                     animations:^{
                             [indicator removeFromSuperview];
                             overlay.alpha = 0.4;
                         }
                    completion:^(BOOL finished){
                        [UIView animateWithDuration:0.4
                                        animations:^{ overlay.alpha = 0.0; }
                                        completion:^(BOOL finished)
                                        {
                                            [overlay removeFromSuperview];
                                        }
                        ];

                        [self.contentView addSubview:self.rentButton];
                        [UIView animateWithDuration:0.4 animations:^{ self.rentButton.alpha = 1.0;}];
                        [self.delegate didTryToRentMovieAtCell:self];
                    }
    ];

}

So the code does fade out the button, replace it with spinner and fades in the red overlay. The problem is, the red overlay does not fade away, but disappears same with the button, instead of fading in, it just appears.

  • 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-15T02:12:33+00:00Added an answer on June 15, 2026 at 2:12 am

    During your animation, you are changing the view hierarchy by adding and removing subviews. The UIView class method animateWithDuration:animations:completion is intended only animating property changes in a view, and not for changing the view hierarchy.

    Try using the UIView class method transitionWithView:duration:options:animations:completion: instead, and use the cell’s content view as the “container.”

    This documentation is helpful in distinguishing between animating view property changes and animating view transitions, specifically the section “Changing the Subviews of a View”:
    http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/viewpg_iphoneos/animatingviews/animatingviews.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add custom behaviour to system classes (FileInputStream/FileOutputStream). I wrote custom ClassFileTransformer
I am trying to add custom labels to my cell in UITableView. When I
I have a custom view class which is a subclass of UITableViewCell. I have
I wrote a custom JSON fetcher. From my view controller I call [loader start];
I have a custom UITableViewCell . It has 3 custom labels inside it with
I have a project with a custom UITableViewCell (cell.h/.m/.xib) that has 2 labels (labelMain/labelSub),
I wrote custom View which draws a circle. Then I put it on relative
I wrote a custom widget for my Django application to interface Twitter Bootstrap's button
I wrote a custom camera activity to handle some issues I've been having with
I wrote a custom Struts RequsetProcessor for my application that is manually fetching some

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.