search

Home  >  Q&A  >  body text

ios - 控制器间传值后,怎么在tableview刷新

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

高洛峰高洛峰2888 days ago417

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 17:56:43

    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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:56:43

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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:56:43

    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.

    reply
    0
  • Cancelreply