开发者

Cocoa Touch Updating UITableView from Core Data

Say I have two UIViewControllers, all working under a UINavigationController:

  1. RootViewController hosts a UITableView which contains a list of domain names.
  2. 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜