数据更改后 Tableview 未重新加载:IOS 5 [英] Tableview not reloading after data change : IOS 5

查看:41
本文介绍了数据更改后 Tableview 未重新加载:IOS 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在以下场景中需要帮助.

I need help in following scenario.

我正在构建一个显示 tableview 的应用程序.如果用户点击一个条目,它会转到详细屏幕.在详细信息屏幕中,我有一个按钮可以删除此条目.它从数据源中删除条目并关闭模态.

I am building an app that displays tableview. If the user tap an entry it goes to the detailed screen. In the detail screen, I have a button to delete this entry. It deletes the entry from the data source and dismiss the modal.

但是关闭模态后,表视图数据不刷新.

But after dismissing the modal, table view data is not refreshing.

如果我回到父视图控制器然后再次回到子屏幕,它会刷新计数.

If I go back to parent view controller and then again come back to child screen, it refreshes the count.

我阅读了一些类似的帖子,并找到了以下解决方案.

I read few similar posts and found the following solution.

[tableview reloadData];

或者

[self.tableView reloadData];

In - (void)viewDidAppear:(BOOL) 动画的子屏幕.但它不会刷新表视图.

In - (void)viewDidAppear:(BOOL)animated of child screen. But its not refreshing the table view.

请帮忙.

推荐答案

通过这段代码:

- (void)viewWillAppear:(BOOL)animated
{ 
    [self.tableView reloadData];
}

这篇关于数据更改后 Tableview 未重新加载:IOS 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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