nsarraycontroller

NSArrayController initialization

你。 提交于 2020-05-09 19:52:26
问题 I am having trouble getting an core-data backed NSArrayController to work properly in my code. Below is my code: pageArrayController = [[NSArrayController alloc] initWithContent:nil]; [pageArrayController setManagedObjectContext:[self managedObjectContext]]; [pageArrayController setEntityName:@"Page"]; [pageArrayController setAvoidsEmptySelection:YES]; [pageArrayController setPreservesSelection:YES]; [pageArrayController setSelectsInsertedObjects:YES]; [pageArrayController

Binding to an NSDictionary's “allValues” array

ぃ、小莉子 提交于 2020-01-24 10:27:49
问题 Am I misunderstanding something about bindings? I bind (an NSArrayController's content) to an NSDictionary's "allValues" array, and it thinks it's empty. I bind to a random object with a property that I've set to be that same NSDictionary's "allValues" array, and it works fine. Is this expected behavior, or am I doing something wrong? Furthermore, if this is expected, what is the standard way to deal with this? Making relatively purposeless objects just to hold arrays in properties so I can

Displaying row index in an NSTableView bound to NSArrayController

穿精又带淫゛_ 提交于 2020-01-22 12:29:19
问题 I have an NSTableView which is bound to an NSArrayController. I would like to have one of the table columns showing the index of the table row. This is easy enough to do when you implement NSTableDataSource yourself but I can't figure it out with a bound table view. I guess I'm looking here for something like the @count key path which gives me the count of arrangedObjects (that is @index) but this is obviously missing. Two clarifications: The index that is shown in each row is the index of

Unable to use Managed Object Context proxy from Interface builder library

末鹿安然 提交于 2020-01-06 14:21:11
问题 I am making a simple mac os x app, in which I will be showing some records in a table view, after retrieving those from local db. I am using core data and NSArrayController proxy for the same and I am trying to achieve it through cocoa-bindings. Now I can easily make it working, by performing this binding in NSArrayController proxy: Proxy: NSArrayController Parameters: Managed Object Context Bind to: App Delegate Model Key Path: self.managedObjectContext but I am trying to use

How to name Undo menu entries for Core Data add/remove items via bindings and NSArrayController?

Deadly 提交于 2019-12-30 07:41:37
问题 I have a NSTableView populated by a Core Data entity and Add Item / Remove Item buttons all wired with a NSArrayController and bindings in Interface Builder. The Undo/Redo menu items can undo or redo the add / remove item actions. But the menu entries are called only „Undo“ resp. „Redo“. How can i name them like „Undo Add Item“, „Undo Remove Item“, etc. (I am aware, something similar was asked before, but the accepted answers are either a single, now rotten link or the advice to subclass

NSCollectionView Master detail binding configuration

爷,独闯天下 提交于 2019-12-25 03:58:06
问题 I have the following models in my application. Board , holds a NSMutableArray property lists of type List below List , holds a NSArray property cards of type Card below Card , has a NSString property name The relationship is thus Board --> to-many List --> to-many Card I have a NSCollectionView based master-detail interface, where I want to display Boards in the master and its corresponding Lists+Cards in the detail view. The master interface is fine, the elements Board are displayed nicely.

How can I subclass NSArrayController to select a text field on add:

旧街凉风 提交于 2019-12-25 03:04:08
问题 This is simple I am sure, but I am still very much learning. I have an NSTableView that is connected to an array controller to display coredata objects. The table is uneditable. When a single record is selected, I have a subview set to be made visible that holds the value of the selection. I'm trying to make it so that when I press the + button connected to add: on my array controller, a new entry will be made and the focus will jump to the item description text field in the subview so that a

Binding an NSTableView to an NSArrayController instead of fetching the data directly from my model array

别等时光非礼了梦想. 提交于 2019-12-25 01:28:49
问题 Current Situation: Direct Binding I have an NSTableView which displays the data that comes from an NSArray of my custom objects. Desired Approach: Array Controller However, It would be "more best practise" to use an NSArrayController instead as a facade to my arbritary model object. So I duplicated the table in my application and created a new NSViewController where I bound the Table Content of the NSTableView to the NSArrayController . I added an IBOutlet for this class so I can now setup my

Singleton NSMutableArray accessed by NSArrayController in multiple NIB's

泄露秘密 提交于 2019-12-24 08:24:45
问题 Early warning - code sample a little long... I have a singleton NSMutableArray that can be accessed from anywhere within my application. I want to be able to reference the NSMutableArray from multiple NIB files but bind to UI elements via NSArrayController objects. Initial creation is not a problem. I can reference the singleton NSMutableArray when the NIB gets loaded and everything appears fine. However, changing the NSMutableArray by adding or removing objects does not kick off KVO to

Simple NSTableView bindings example

二次信任 提交于 2019-12-24 07:26:21
问题 I am trying to populate a 2-column NSVTableView via bindings, but the data is not showing up in the table. In XCode: I have a NSMutableArray in my AppDelegate that will hold the data, as well as the corresponding @property and @synthesize. On an event, I call [removeAllObjects] on the NSMutableArray and repopulate it with some NSDictionary objects. Each dictionary contains 2 KVP's: a NAME and a VALUE. In IB: I added an NSArrayController and bound it's Content Array to my AppDelegate and set