ios - 控制器间传值后,怎么在tableview刷新
高洛峰
高洛峰 2017-04-17 17:54:43
0
3
416

像电商物流类app,都有添加常用地址,在二级页面填完地址信息后,通过block回调可以实现二级页面到一级页面的传值,但是,在二级页面返回一级页面的时候,怎么刷新一级页面的tableview,传递的值怎么保存?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(3)
Peter_Zhu

The first method is to use delegate. After passing the value, call the tableView reloadData method on the first-level page. The passed value can be saved locally or temporarily saved in the first-level page variable.
The second method is BLOCK, on ​​the second-level interface. Define Block and then call it. When Block defines the function block in the first-level page, add [self.tableView reloadData] to the function after passing the value

洪涛

You can use Delegate to transfer values ​​between pages
Define a Delegate method and call TableView.reload() in it

Ty80

Third way: Using MVVM, the data is stored in the viewModel, and the view binds the data in the viewModel. When the data changes, the view layer receives a notification, and then the interface can be updated. Binding can be implemented using ReactiveCocoa or RxSwift.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template