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
5
votes
1 answer

NSTableView backed by NSArrayController: why does setContent: work while IB doesn't?

I am trying to implement pretty much the simplest case of binding a NSTableView to a NSArrayController, so that the NSTableView is backed by an NSArray. Here is the setup: I have an NSArrayController whose 'Content Array' is bound to an NSArray in…
jogloran
  • 952
  • 1
  • 12
  • 23
5
votes
1 answer

Objective-C undo manager questions

I'm reading a book on Objective-c and learning about the undo manager. The concept seems very simple but the provided example seems overly complex. Basically, I have a table view connected to an NSArrayController and I add or remove people to an…
JPC
  • 8,096
  • 22
  • 77
  • 110
5
votes
5 answers

NSArrayController : removeAllObjects does not refresh TableView

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…
TalkingCode
  • 13,407
  • 27
  • 102
  • 147
5
votes
1 answer

How do I share an NSArrayController between two nib files?

I have an array of images, and two nib files. One nib file has a window that displays the images in an NSTableView. The other nib has a window that draws the array of images into an NSView, and also draws a highlight over the images that are…
Tom Dalling
  • 23,305
  • 6
  • 62
  • 80
5
votes
1 answer

Managing an Ordered Core Data Relationship Using NSArrayController

All those “NSOrderedSet was added later and thus doesn’t have to play nice with other components” bugs drive me crazy… (https://twitter.com/kubanekl/status/413447039855640576) I have two managed objects and an ordered 1:N relationship between…
5
votes
5 answers

NSArrayController and KVO

What do I need to do to update a tableView bound to an NSArrayController when a method is called that updates the underlying array? An example might clarify this. When my application launches, it creates a SubwayTrain. When SubwayTrain is…
Ben Packard
  • 26,102
  • 25
  • 102
  • 183
5
votes
2 answers

Binding NSArrayController to NSSearchField and viewing result in NSTableView

My app description, Add NSMutableArray with some items (say 1- 50) Add NSArrayController and add/bind that array to this arrayController Add NSTableView to my view and populate them using the concept of BINDINGS. Finally add a NSSearchField and…
Xander
  • 902
  • 2
  • 14
  • 33
5
votes
1 answer

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

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…
4
votes
2 answers

KVO: Cannot remove an observer

In my interface I have an NSTextField who's value is bound to an NSArrayController's selection.selectedType.title. All of the NSArrayController's objects are custom objects each with two methods: - (MYType *)selectedType; - (void)setSelectedType:…
4
votes
1 answer

setFilterPredicate on a NSArrayController doesn't work if it's in "Auto Rearrange Content"

I have a classic CoreData application, displaying it's data in NSTableView with Binding (all done with XCode 4.2). Working fine until I decide yesterday to check, in Attributes Inspector, the 'Auto Rearrange Content' for the ArrayController. Now,…
4
votes
1 answer

Changing visibility of NSPopUpButton's items based on keypress

I've got an application here that needs to read in a bunch of data from an external file and display it as a NSPopUpButton in a Cocoa user interface. The catch here is that the data that is being read in needs to have a flag that states if it is…
user1004332
4
votes
1 answer

How to show button cell (check box) title in table view, using bindings

I am trying a simple application where I have a mutable array of mutable dictionaries, such as - NSMutableDictionary *sample6 = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"title6",@"title",[NSNumber numberWithBool:NO],@"state", nil]; In…
Devarshi
  • 16,440
  • 13
  • 72
  • 125
4
votes
3 answers

Why is an NSArrayController "losing" its sort after an object is inserted?

I have an NSArrayController bound to a property of an NSManagedObject subclass. The subclass is automatically generated by mogenerator (which creates a set property for the relationship). The NSArrayController is bound to network.posts where 'posts'…
Matt Mower
  • 3,743
  • 1
  • 18
  • 12
4
votes
1 answer

Cocoa binding to a particular item in an array controller

Is it possible using NSArrayController to bind a NSTextField's value to a particular item in the array? In particular, I want to bind to a property on the first item in the array, and show nothing if the array is empty. Using…
4
votes
1 answer

Row animations for NSTableView with Bindings

I have an NSTableView which uses an array controller as binding to a dynamic array and it works great. Now I realized that when I am appending / inserting an element to the array the row is directly added to the table view without the row insert…
Sebastian
  • 8,952
  • 3
  • 32
  • 30
1 2
3
35 36