开发者

UITableView reloadSections creates a sectionheader on top of a row

I have a tableview with one sectionheader. With the following codesnippet I reload the tableview when a user swipes the view left or right.

[self.tableView beginUpdates];
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]    withRowAnimation:UITableViewRowAnimationLeft];
[self.tableView reloadRowsAtIndexPaths:[self.tableView indexPathsForVisibleRows] withRowAnimation:UITabl开发者_StackOverfloweViewRowAnimationLeft];
[self.tableView endUpdates];

When a user has scolled downwards in the tableview and then swipes, this codesnippet reloads the rows correctly but the sectionheader is created on top of the row where the swipe was initiated.

Can anyone tell me what I'm doing wrong & how to solve ?

thanks Frank


I think the problem is that reloadSections:withRowAnimation seems to be buggy on iOS 4.0, and it was fixed in one of the later versions.

On iOS 4.0 calling reloadSections:withRowAnimation results in table header appearing in the middle of a row, and on 4.3 it works fine. I've replaced it with reloadData which is less optimal, but works on 4.0 too.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜