Say I have two UIViewControllers
, all working under a UINavigationController
:
RootViewController
hosts a UITableView which contains a list of domain names.CodeViewController
shows a domain.
A user can view any domain they like; once the domain is viewed in CodeViewController
, the name is added to the store via Core Data.
When the user hits the back button to return to the RootViewController
, I want that new domain to appear in the UITableView
. I can't make this happen.
I've attempted several techniques like flushing out the array that supplies the values to the table; I've put my CD开发者_如何学C calls into viewWillAppear
(currently in viewDidLoad
).
On the Mac, I'd just use bindings to bind the table to the CD model, but how would you do it on the iPhone? I'm stumped!
Thanks, Aaron.
Typically you implement an NSFetchedResultsController in between your Core Data data and your table view.
It has delegate methods such controllerDidChangeContent:
to inform you that the content has changed and the table view needs updating (you could call reloadData
on the table view).
精彩评论