开发者

Updating UITableViewCell not refreshing the UI

开发者 https://www.devze.com 2023-03-20 15:38 出处:网络
I have a UITableView and on the first time cellForRowAtIndexPath is called, I save all the UITableViewCell values I return.I do this so that I can update the contents when everthe underlying data chan

I have a UITableView and on the first time cellForRowAtIndexPath is called, I save all the UITableViewCell values I return. I do this so that I can update the contents when ever the underlying data changes.

However, when I update the contents of the UITable开发者_如何学PythonViewCell, the UITableView does not show the new entries until I scroll up and down on the UI. How do I programatically force the refresh?


The UITableView has a method „reloadData.“ Just call it:

[tbl reloadData]


You can first save the index position of your cell, refresh your datas and then scroll automatically to your index.

So save it then call reloadData method and then scroll it to your save.

0

精彩评论

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