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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:10:55+00:00 2026-05-23T16:10:55+00:00

i have a UITableViewCell, and i am trying to add an animation that causes

  • 0

i have a UITableViewCell, and i am trying to add an animation that causes a layer to scroll off of the cell, the problem is it gets clipped by the cell above it, is there an easy way to get around this?

here is my method.

- (void)animateLife:(UIButton *)sender isPositive:(BOOL)state{

    // Reset lCount if we are pressing a different button than last time.
    if (sent != sender) {
        lCount = 0;
    }
    sent = sender;

    // Increase the count by 1.
    lCount = lCount + 1;

    // Set up some properties.
    CGPoint origin = sender.center;
    CGPoint newOrigin = CGPointMake(origin.x, (origin.y - 100));
    NSString *oper = [[NSString alloc] init];

    // Check to see if this is a + or - change.
    if (state == true) {
        oper = @"+";
    } else {
        oper = @"-";
    }

    // Alloc a String and a Label to hold it.
    NSString *characters = [[NSString alloc] initWithFormat:@"%@%d", oper, lCount];
    UILabel *theLabel = [[UILabel alloc] initWithFrame:CGRectMake(origin.x,origin.y , 50, 50)];

    // Configure the Label.
    if (oper == @"-") {
        [theLabel setTextColor:[UIColor redColor]];
    } else {
        [theLabel setTextColor:[UIColor greenColor]];  
    }
    [theLabel setText:characters];
    [theLabel setBackgroundColor:[UIColor clearColor]];
    [theLabel setAlpha:1];
    [theLabel setCenter:origin];
    [theLabel setShadowColor:[UIColor blackColor]];
    [theLabel setShadowOffset:CGSizeMake(0.5, 0.5)];
    [theLabel setFont:[UIFont fontWithName:@"Helvetica" size:28]];
    [theLabel setTextAlignment:UITextAlignmentCenter];
    [theLabel.layer setShadowRadius:3];
    [theLabel.layer setShadowOpacity:0.9];

    // Display our Label.
    [sender.superview insertSubview:theLabel aboveSubview:sender];

    // Setup animation.
    [UIView beginAnimations:@"lifeCount" context:nil];
    [UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationDelegate:self];
    [theLabel setCenter:newOrigin];
    [theLabel setAlpha:0];

    // Commit Animation.
    [UIView commitAnimations];

    fCount = fCount + 1;
    // Clean up.
    [theLabel release];
    [characters release];
    [oper release];
}

- (void) animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {

    // Since an animation finished, reduce count by one.
    fCount = fCount - 1;

    //check if all animations are finished, if so, reset the lCount.
    if (fCount < 1) {
        lCount = 0;
    }
}

Update: it appears if i scroll cells to where they get reused, then the animation shows up properly is there a way i can make it not require the reuse?

  • 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-23T16:10:56+00:00Added an answer on May 23, 2026 at 4:10 pm

    In your method cellForRowAtIndexPath there is probably code like this:

     cell = [tableView dequeueReusableCellWithIdentifier:someCellID];
     if ( cell == nil ) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                           reuseIdentifier:kCellID] autorelease];
     }
    

    Do not call the “dequeueReusableCellWithIdentifier” method. Just create new cell each time.

    Note that if you have a lot of rows in your table, this will have a performance hit.

    • 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 a subview to a UITableViewCell and the design that I'm
I'm trying to set up a UITableViewCell that can have an image in the
I am trying to add margin to a cell. I have tried many times
Hi I'm trying to have my uitableviewcell rendered inactive so that a user can't
I have a custom UITableViewCell subclass. I have set the contentView of my cell
I am trying to have a tableview that leads to another tableview whose list
I have a subclass of UITableViewCell and am trying to use it. At the
I am trying to create a UITableViewCell with multiple labels. I have been trying
I'm trying to learn objective-c, and have a question regarding this method: - (UITableViewCell
I am trying to add a new view with 5 buttons to a cell

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.