Wednesday 15 January 2014

cocoa - Display data from NSArray in NSTableView -


I have a problem, and I think that's the right solution, but I can not understand it!

I have this piece of code:

  NSManagedObjectContext * context = [[NSApp Rep] Managed Object Contex]; NSManagedObjectModel * Model = [[NSApp Rep] Managed Object Modes]; NSDictionary * entities = [model entities] NSEntityDescription * entity = [entities valueForKey: @ "post"]; NSPredicate * predicate; Predicate = [NSPredicate predicateWithFormat: @ "Date & lt;% @", [NSDT Date]]; NSSortDescriptor * sort = [[NSSortDescriptor alloc] initWithKey: @ "Date" ascending: Yes]; NSArray * Sort descriptor = [NSArray arrayWithObject: sort]; NSFetchRequest * fetch = [[NSFetchRequest alloc] init]; [SetEntity bring: unit]; [Set pediatric: present]; [SetSortDescriptors Fetch: Sort Descriptor]; NSArray * Result = [reference executeFetchRequest: Fetch error: zero]; [Sort release]; [Get the release];  

This gives the specified data in an array. Now I want to display this data in an NSTableView.

How can I go about doing this?

Thank you!

You can use it as the data for NSArrayController, which you bind to NSTableView Are there.


No comments:

Post a Comment