If I am inserting one by one row then this animation is working from bottom to top animation. and make a condition when you scroll top to bottom at that time not animation, but I want to also stop animation after one time animation from bottom to top.
in willDisplayCell of tableview method :
if (tempIndex == nil)
{
CGRect myRect = [tableView rectForRowAtIndexPath:indexPath];
//instead of 568, choose the origin of your 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 much you want the cell to get "under" the 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 the origin of your 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 much you want the cell to get "under" the 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;
}
Aucun commentaire:
Enregistrer un commentaire