King
King

Reputation: 1

An Strange UITableView scrollToRowAtIndexPath behaviour

When I Use [self.chatContentTable scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:bottomFlag+2 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];

when the animated set YES,my tableView will scroll,but when the animated set NO,it donest work

Upvotes: 0

Views: 151

Answers (1)

zhonghao liang
zhonghao liang

Reputation: 1

I also found it.

My code is:

 [self.tableView reloadData];
 [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]atScrollPosition:UITableViewScrollPositionMiddle animated:animation];

It work after remove reloadData. I guess the reason why it does not take effect is that it's executed immediately after reload

Upvotes: 0

Related Questions