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

Basic structure NSArrayController in multiple views with storyboards

I really need some help here. Ever since I started programming with Cocoa I had problems getting my head around multiple view controllers and array controllers. I always got through with some bad glueing code and a bad code structure. I'm starting…
4
votes
3 answers

Exposing model object using bindings in custom NSCell of NSTableView

I am struggling trying to perform what I would think would be a relatively common task. I have an NSTableView that is bound to it's array via an NSArrayController. The array controller has it's content set to an NSMutableArray that contains one or…
4
votes
1 answer

How does NSTableView modify the selection of NSArrayController via bindings?

Let's say I have the following situation: When I select different rows in the NSTableView, it magically updates the NSArrayController (PersonController) selection. How is the NSTableView doing this? Does it do something like this: -…
Tom Dalling
  • 23,305
  • 6
  • 62
  • 80
4
votes
2 answers

NSManagedObjectContext and NSArrayController reset/refresh problem

I'm having trouble getting my UI to reflect external changes (made by another process) to an sqlite data store. I have a fairly standard core data based NSArrayController / table view. My app gets notified that external changes have been made to the…
Adrian
  • 1,066
  • 1
  • 13
  • 20
4
votes
1 answer

Lazy Fetching & Maintaining a sorted NSArrayController

I've got a sample project at https://github.com/ericgorr/LazyFetching The setup is pretty straightforward. In my CoreData model, I have two entities: Shelf which has a name property and a to-many relationship (items) to the Item entity Item which…
ericg
  • 8,413
  • 9
  • 43
  • 77
4
votes
1 answer

Cocoa Bindings error

Trying to wrap my head around cocoa bindings can't determine the reason for this error I Have a simple app, in which, the app delegate passes the Managedobjectcontext to Window Controller, which passes it to a view controller. The nib associated…
Cory
  • 2,302
  • 20
  • 33
4
votes
1 answer

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

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…
Matthew
  • 103
  • 4
4
votes
1 answer

NSArrayController selectedIndex changing to 0 after addObject is called

My setup: I'm making a tab-based application using an NSTableView to display tabs and allow users to select tabs. I have an NSTableView bound to an NSArrayController (tableView.content is bound to arrayController.arrangedObjects,…
Chris R
  • 2,875
  • 2
  • 28
  • 29
4
votes
4 answers

NSArrayController: How to programmatically clear selection?

Very simple question that's driving me crazy: What's the proper way to clear the selection of an NSArrayController programmatically? I'm designing a view with the following components: NSArrayController *controller1: Bound to an array of…
David Stein
  • 866
  • 7
  • 21
4
votes
0 answers

MVC Design: How many array controllers do I need?

I have a pretty straightforward MVC design question. I've got a class with a bunch of properties, and a form to present an instance of the class. Several of the class properties are arrays - some are arrays of NSStrings to be presented in a…
David Stein
  • 866
  • 7
  • 21
3
votes
2 answers

What is the correct way to tell when an NSArrayController is finished loading its content from a persistent store?

What's the best way to know when my array controller that is bound to my core data store is done loading its content? I've got some methods (i.e. awakeFromNib) that rely on the array controller having its content, but most of the time the array…
catsby
  • 11,276
  • 3
  • 37
  • 37
3
votes
1 answer

How to setup NSArrayController with Core Data?

I am trying to programmatically setup an NSArrayController to work with Core Data. I know that my Core Data store has content since I can manually retrieve objects through the managed object context. I hooked up an NSArrayController to the same…
David
  • 14,205
  • 20
  • 97
  • 144
3
votes
1 answer

Is it possible to use Cocoa's Bindings to have an editable NSTableView hooked up to an NSMutableArray?

It seems from the bits and pieces I can scrape together that the answer to this one will be "no", so I'll broadly explain what I'm trying to achieve in (the likely) case that I'm trying to hammer in a screw. What I have in my app is a list of valid…
Drarok
  • 3,612
  • 2
  • 31
  • 48
3
votes
1 answer

How to prevent retain cycles caused by binding to self

I have an application where I need to access model data from my subviews. I've been using bindings to pass data across views; however, the bindings to self seem to be causing retain cycles (dealloc never gets called). When should I remove the…
panupan
  • 1,212
  • 13
  • 15
3
votes
0 answers

Multiple filtered lists per NSArrayController

What I need to do is simple, Say I have a list of student domain objects @implementation Student : CPObject { CPString name @accessors; BOOL isLate @accessors; BOOL isMale @accessors: } I have a list of these Student objects stored in…