nsarraycontroller

How do you populate a NSArrayController with CoreData rows programmatically?

允我心安 提交于 2019-12-08 05:50:38
问题 After several hours/days of searching and diving into example projects I've concluded that I need to just ask. If I bind the assetsView ( IKImageBrowserView ) directly to an IB instance of NSArrayController everything works just fine. - (void) awakeFromNib { library = [[NSArrayController alloc] init]; [library setManagedObjectContext:[[NSApp delegate] managedObjectContext]]; [library setEntityName:@"Asset"]; NSLog(@"%@", [library arrangedObjects]); NSLog(@"%@", [library content]); [assetsView

How to bind NSArrayController to NSManagedObjectContext when using MagicalRecord

血红的双手。 提交于 2019-12-08 03:17:33
问题 Ive recently started migrating a project to MagicalRecord and cant find how i would bind it to an NSArrayController in the interface builder of XCode 4. The approach ive taken so far (besides lots of google) is making a reference to the [MagicalRecord defaultContext] and binding to that but i get an error: "Cannot perform operation without a managed object context" Any pointers in the right direction would be really appreciated. 回答1: Make sure you turn on MagicalRecord as mentioned in the

Cocoa bindings problem; bound table columns don't show any data, no errors in console

别等时光非礼了梦想. 提交于 2019-12-08 02:32:17
问题 I'm having trouble converting my Cocoa project from a manually-synched interface model to a bindings model so that I don't have to worry about interface glue code. I followed the CocoaDevCentral Cocoa Bindings tutorial to make sure that I had covered all the bases, but things aren't working correctly. I have a master-detail interface, but I'm having trouble even getting the master portion of the interface to work correctly. No data is showing up in the master column, even though I've set up

Realm + NSTableView + NSArrayController

流过昼夜 提交于 2019-12-07 16:50:17
问题 i have some Problems with my macOS Application and hope you can help me. Im pretty new on macOS so please be nice ;) A part of the app consists of a simple NSTableView which content is binded to an NSArrayController. The NSArrayController is feeded from a realm database. As you can see there is a checkbox for each row, which should set the bool value in the realm object. The bindings are ok, so if I mark/unmark the checkbox it seems to try writing on the realm object. But since realm needs a

How do I delete an entity when removing it from an array controller?

强颜欢笑 提交于 2019-12-07 08:35:23
问题 I have an entity (e.g. Employee) in a managed object model that is related to two other entities (e.g. Department and Team). Both relationships are one-to-many (i.e. an Employee must have one Department and one Team, Teams and Departments have many Employees). The two may or may not overlap (e.g. a team might be made up of employees from HR, Accounting & I.T. or it might jut consist of several employees from the one department). Department <-->> Employee <<--> Team I have two

KVO: +keyPathsForValuesAffecting<Key> doesn't work with (subclass of) NSObjectController

为君一笑 提交于 2019-12-07 05:28:35
问题 I have a KVO-able class (call it Observee ), which affectedValue dynamic property is affected by affectingValue property. The dependency between the properties is defined by implementing +keyPathsForValuesAffectingAffectedValue method. Setting a value to affectingValue notifies that affectedValue has changed as I expected, unless Ovservee is a subclass of NSObjectController . Full example follows: @interface Observee : NSObject // or NSObjectController @property (readonly, strong, nonatomic)

NSArrayController : removeAllObjects does not refresh TableView

流过昼夜 提交于 2019-12-07 04:46:29
问题 In my application I add objects directly to an ArrayController. When I want to clean all items I do: [[downloadItemsController content] removeAllObjects]; This command however does not refresh the TableView the arraycontroller is bound to. If I remove all items and add another new items I only see that item. That is fine but if I don't add anything I still have all my items in the table. If I do [downloadItemsController prepareContent]; all old items are removed from the tableview but than I

Mac OS X replacement for NSFetchedResultsController

风流意气都作罢 提交于 2019-12-06 22:41:42
问题 So I'm used to iOS development so I'm pretty happy with NSFetchedResultsController. However, this is not present in the Mac OS X environment. I know that I can use NSArrayController as a replacement. I might be using this class terribly wrong but it worked until now. I initialize the NSArrayController as follows: NSArrayController* newConversationsController = [NSArrayController new]; newConversationsController.managedObjectContext = context; newConversationsController.entityName = entityName

How do you populate a NSArrayController with CoreData rows programmatically?

爱⌒轻易说出口 提交于 2019-12-06 19:45:36
After several hours/days of searching and diving into example projects I've concluded that I need to just ask. If I bind the assetsView ( IKImageBrowserView ) directly to an IB instance of NSArrayController everything works just fine. - (void) awakeFromNib { library = [[NSArrayController alloc] init]; [library setManagedObjectContext:[[NSApp delegate] managedObjectContext]]; [library setEntityName:@"Asset"]; NSLog(@"%@", [library arrangedObjects]); NSLog(@"%@", [library content]); [assetsView setDataSource:library]; [assetsView reloadData]; } Both NSLogs are empty. I know I'm missing something

NSArrayController rearrangeObjects error

两盒软妹~` 提交于 2019-12-06 16:07:06
I have troubles with NSArrayController rearrangeObjects function - this function called from some background treads and sometimes App crashes with error: 'endUpdates called without a beginUpdates'. How can i detect if arrayController is rearranging objects in current moment and add next rearrange to some like queue or cancel current rearranging and run new? May be there is another solution for this problem? Edit code added: TableController implementation: - (void)setContent{//perfoms on main thread //making array of content and other functions for setting-up content of table //... /