UITableViewCell Moving Animation

I am trying to start the animation inside a UITableViewCell, but it will not start unless I do something stupid. The code is called, but the animation just does nothing. If I delay it by placing it in dispatch_async , then it will work. Why is this happening? What do I need to wait to start the animation?

 - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if(mNeedsAnimation) { //this will delay it a bit and make it work, but why? //dispatch_async(dispatch_get_main_queue(), ^(void){ ( mViewToAnimate.transform = CGAffineTransformMakeScale(0.5f, 0.5f); mViewToAnimate.hidden = NO; mViewToAnimate.alpha = 1.f; [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionRepeat|UIViewAnimationCurveLinear animations:^{ mViewToAnimate.alpha = 0.0; mViewToAnimate.transform = CGAffineTransformMakeScale(1.f, 1.f); }completion:nil]; //}); mNeedsAnimation = NO; } } 
+4
source share
1 answer

I think this is because when the called CallDisplayCell is called, the cell remains off-screen and cannot have animation.

+2
source

All Articles