如图,点击run运行,在VC1页面第一次输入一条22信息,点击添加按钮,跳转至VC2页面(通过self.tabBarController.selectedIndex = 1;来实现),且输入的信息能在表格单元中显示,随后又在VC1页面第二次输入另一条33信息,点击添加按钮,页面也跳转至VC2页面,但33的信息没有在表格中显示。
我若重新run运行,33的信息在VC2页面又显示出来了。
我想知道,在第二次操作时,重新输入另一条信息,表视图的数据怎么刷新?(是用sqlite来储存数据的)。
黄舟2017-04-18 09:56:39
After the addition is successful, a notification can be sent to vc1 and received by vc2
After receiving the message, vc2 gets the updated data from sqlite and calls the reloadData method of tableview
黄舟2017-04-18 09:56:39
Data loss in tableview usually means there is a problem with the data source or it is not refreshed. From your description, you said that new data can be displayed after re-running, and your data is stored through SQLite, so it should be Is there something wrong with the data source you obtained from sqllite? Is the data not updated? After writing, the original data is still displayed?