Cocoa Touch Updating UITableView from Master Data

Let's say I have two UIViewControllers, all work under UINavigationController:

  • RootViewController hosted a UITableView that contains a list of domain names.
  • CodeViewController shows the domain.

The user can browse any domain that they like; as soon as the domain is viewed in CodeViewController, the name is added to the repository through Core Data.

When the user clicks the back button to return to RootViewController, I want the new domain to appear in UITableView. I can not do it.

I tried to execute several methods, such as clearing an array that passes values ​​to a table; I put my calls on CD in viewWillAppear(currently in viewDidLoad).

On a Mac, I just used bindings to snap a table to a CD model, but how would you do it on an iPhone? I'm at a dead end!

Thanks, Aaron.

+3
source share
1 answer

Typically, you execute an NSFetchedResultsController between master data and a table view.

It has delegation methods, such as controllerDidChangeContent:to inform you that the contents have changed and the table update needs updating (you can call reloadDatain the table view).

+6
source

Source: https://habr.com/ru/post/1731488/


All Articles