ios - UITableview Cell animation -
if inserting 1 one row animation working bottom top animation. , make condition when scroll top bottom @ time not animation, want stop animation after 1 time animation bottom top.
in willdisplaycell
of tableview
method :
if (tempindex == nil) { cgrect myrect = [tableview rectforrowatindexpath:indexpath]; //instead of 568, choose origin of animation cell.frame = cgrectmake(cell.frame.origin.x, cell.frame.origin.y + 568, cell.frame.size.width, cell.frame.size.height); [uiview animatewithduration:0.3 delay:0 options:uiviewanimationoptioncurveeaseinout animations:^{ //instead of -30, choose how want cell "under" cell above cell.frame = cgrectmake(myrect.origin.x, myrect.origin.y , myrect.size.width, myrect.size.height); } completion:^(bool finished){ [uiview animatewithduration:0.3 animations:^{ cell.frame = myrect; }]; }]; tempindex = indexpath; } else if (tempindex.row < indexpath.row) { cgrect myrect = [tableview rectforrowatindexpath:indexpath]; //instead of 568, choose origin of animation cell.frame = cgrectmake(cell.frame.origin.x, cell.frame.origin.y + 568, cell.frame.size.width, cell.frame.size.height); [uiview animatewithduration:0.3 delay:0 options:uiviewanimationoptioncurveeaseinout animations:^{ //instead of -30, choose how want cell "under" cell above cell.frame = cgrectmake(myrect.origin.x, myrect.origin.y, myrect.size.width, myrect.size.height); } completion:^(bool finished){ [uiview animatewithduration:0.3 animations:^{ cell.frame = myrect; }]; }]; tempindex = indexpath; } else { tempindex = indexpath; }
you can maintain integer index of rows till tableview has animated
//assuming animatedtill property initialized 0 if (indexpath.row > self.animatedtill) { cgrect myrect = [tableview rectforrowatindexpath:indexpath]; //instead of 568, choose origin of animation cell.frame = cgrectmake(cell.frame.origin.x, cell.frame.origin.y + 568, cell.frame.size.width, cell.frame.size.height); [uiview animatewithduration:0.3 delay:0 options:uiviewanimationoptioncurveeaseinout animations:^{ //instead of -30, choose how want cell "under" cell above cell.frame = cgrectmake(myrect.origin.x, myrect.origin.y , myrect.size.width, myrect.size.height); } completion:^(bool finished){ [uiview animatewithduration:0.3 animations:^{ cell.frame = myrect; self.animatedtill = indexpath.row }]; }]; }
Comments
Post a Comment