Questions tagged [nsarraycontroller]

on Mac OS X, NSArrayController is a bindings compatible class that manages a collection of objects

NSArrayController is a Cocoa class intended to bridge an array (instance of NSArray or its subclasses) and a suitable view, for instance a table view.

It provides a simple interface to add, remove, filter and sort the array, as well as the necessary bindings to interface these functions to Cocoa actions.

More information in the official docs

532 questions
3
votes
2 answers

NSArrayController not working with NSMutableDictionary for NSTableView

I am trying to display content in NSTableView using NSMutableArrayController of NSMutableDictionary records. I followed steps written below: In application delegate class, I created an NSMutableArray object with name 'geniuses' and stored some…
Devarshi
  • 16,440
  • 13
  • 72
  • 125
3
votes
2 answers

Subclassing NSArrayController in order to limit size of arrangedObjects

I'm trying to limit the number of objects in an array controller, but I still want to be able to access the full array, if necessary. A simple solution I came up with was to subclass NSArrayController, and define a new method named…
3
votes
1 answer

View-based table bindings in Swift

I'm trying to set up a view-based table in Swift using bindings. All of the examples I've seen use a datasource/delegate setup. I have an array of Flag objects which has two properties - flagName: String and flagImage: NSImage. I have an…
green_knight
  • 1,319
  • 14
  • 26
3
votes
1 answer

Model Key Path With Multiple Properties

Here, I'm using an NSArrayController to bind properties from Core Data entities into the value of text view table cells. What syntax do I use to access multiple properties of the entity in the Model Key Path? Example as a format string: @"%@, %@",…
The Kraken
  • 3,158
  • 5
  • 30
  • 67
3
votes
2 answers

Binding selection across multiple view controllers in a single window interface

I am having an issue wrapping my head around how to hook up a few NSArrayControllers across two view controllers. I want to sync the selection in the source list table view to update the values in the second detail view controller. I'm using the…
3
votes
1 answer

Binding to an NSDictionary's "allValues" array

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…
andyvn22
  • 14,696
  • 1
  • 52
  • 74
3
votes
1 answer

KVO on adding/removing objects through NSArrayController

How can I get a notification when an object has been added/removed through an NSArrayController ? I tried something like [core addObserver:self forKeyPath:@"arrangedObjects" options:0 context:nil]; I do get a notification of something has…
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
3
votes
4 answers

Deleting an object in NSArrayController

I have an NSTableView which gets its data from an NSArrayController and I need to delete the currently selected row. I know NSManagedObjectContext has a deleteObject: method but, I can't think of how to delete it from the NSArrayController.
nanochrome
  • 707
  • 2
  • 12
  • 26
3
votes
1 answer

Table view not updating according to bindings - Part Two

Title borrowed from this question, of which this one is not a duplicate. See my answer there for what was wrong for that questioner; I'm the author of that answer, and my problem is not that one. I have a table view with three columns, whose Value…
Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
3
votes
2 answers

Bindings - master detail array controllers

I really hope someone can help on this because I'm learning cocoa and have hit a road block. I am trying to model a simple poker tournament. For now, my entities are simply a Tournament (with a number) and a Player (with a Name). A Tournament has…
Ben Packard
  • 26,102
  • 25
  • 102
  • 183
3
votes
1 answer

Safely remove NSView that contains cocoa bindings

I have an inspector pane in my app that contains a bunch of controls. These controls are bound to my model objects through an NSArrayController. Depending on what type of object is selected I am displaying a different set of inspectors (just like…
DrummerB
  • 39,814
  • 12
  • 105
  • 142
3
votes
2 answers

Binding Cocoa NSComboBox value to object

Assuming I have an NSObject subclass representing a country, e.g. @interface CountryInfo : NSObject @property (nonatomic, retain) NSString *countryName; My model contains an NSMutableArray of CountryInfos. I want to bind the array to an…
TheNextman
  • 12,428
  • 2
  • 36
  • 75
3
votes
3 answers

Refresh Cocoa-Binding - NSArrayController - ComboBox

in my application I made a very simple binding. I have a NSMutableArray bound to a NSArrayController. The controller itself is bound to a ComboBox and it shows all the content of the NSMutableArray. Works fine. The problem is : The content of the…
TalkingCode
  • 13,407
  • 27
  • 102
  • 147
3
votes
1 answer

Filtering a single-column NSTableView using NSArrayController

I present a sheet with an NSTableView (one column), an NSSearchField and an NSButton ('Add'). What I want is to set the content of the table view to a list of strings. This list of strings is in an NSArray called list. This content should be…
Fatso
  • 1,278
  • 16
  • 46
3
votes
1 answer

How to bind to NSArrayController's arranged objects

I would like to programmatically bind a custom class (MyClass) array to an array controller (NSArrayController) with its content bound to another array (modelArray). MyClass displays the content of the array, like a NSTableView. My problem is: how…
trfd
  • 93
  • 1
  • 7