如何在调用-reloadData后保留UITableView contentoffset [英] How to keep UITableView contentoffset after calling -reloadData

查看:858
本文介绍了如何在调用-reloadData后保留UITableView contentoffset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CGPoint offset = [_table contentOffset];
[_table reloadData];
[_table setContentOffset:offset animated:NO];    //unuseful

//    __block UITableView *tableBlock = _table;
//    [self performBlock:^(id sender) {
//        [tableBlock setContentOffset:offset];
//    } afterDelay:2];

我知道没有在 reloadData
afterDelay:2 可能太短或太长,所以我该如何实现呢?

I know no delegate method that is called after reloadData. And afterDelay:2 may be too short or too long, so how can i implement it?

我的英语不好,我希望你能理解......

My English is not good, i hope you can understand...

推荐答案

我最近在使用 reloadData - reloadData 不会更改 contentOffset 或滚动表格视图。如果偏移量小于新的数据量,它实际上保持不变。

I was recently working with reloadData -- reloadData doesn't change the contentOffset or scroll the table view. It actually stays the same if the offset is less than the new amount of data.

这篇关于如何在调用-reloadData后保留UITableView contentoffset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆