开发者

How to animate the hight change of an UITableViewCell?

In -tableView:heightForRowAtIndexPath: I'm changing the height for a cell dynamically during usage of the table. But I don't want this to happen like BAAANNGGG..., I want it nicely animated. Where would I put the animation blo开发者_开发百科ck? Would that go just around the -reloadData call?

Well, at least this does nothing:

[UIView beginAnimations:@"foo" context:nil];
[UIView setAnimationDuration:3];
[self.table reloadData];
[UIView commitAnimations];

don't get any animation here...


Potentially the following is a better option if you're on iOS 3.0 and up:

[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];

Change the animation to match your preference of course...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜