Questions tagged [cocoa-bindings]

Cocoa bindings is Apple’s implementation of the Model-View-Controller design pattern for Mac OS X applications. It provides technologies that automate the synchronisation of domain data and the user interface elements that present them.

975 questions
5
votes
1 answer

Inserting controller logic between model and view when using Interface Builder, NSObjectController sub-classes, and bindings

I've been struggling to understand the best way to insert controller logic when using IB, NSObjectController sub-classes and bindings. I need to insert controller logic between the model and the view, and I'm struggling to find an elegant way to do…
Tricky
  • 7,025
  • 5
  • 33
  • 43
5
votes
4 answers

How to trigger an action from a NSTableCellView in view based NSTableView when using bindings

I'm facing a problem with a view-based NSTableView running on 10.8 (target is 10.7, but I think this is not relevant). I'm using an NSTableView, and I get content values for my custom NSTableCellView through bindings. I use the obejctValue of the…
5
votes
1 answer

Cocoa: How to bind a boolean property to NSCellStateValue?

I would like to bind the boolean enabled property of an NSTextField to the state of an NSButton. I already tried adding a custom NSValueTransformer that transforms the state of the NSButton into NSNumber. However, in that scenario the text fields…
JJD
  • 50,076
  • 60
  • 203
  • 339
5
votes
1 answer

With Cocoa Bindings, changing the value of NSTextField programmatically does not update the model

I have a NSTextField bound to my model. If I change the content of the text field programmatically, the model isn't updated. I know that you're supposed to update the model instead. But I'm trying to implement an NSTextField subclass that recognizes…
DrummerB
  • 39,814
  • 12
  • 105
  • 142
4
votes
1 answer

Cocoa, binding using Collection Operators and To-Many relationship properties

Having done a fair amount of google and looking on here I believe the following can't be done. I'm interesting in why it can't be done and people best workarounds, I offer mine below. I use the simple department <---->> employee model, with both…
Quantum_Oli
  • 267
  • 2
  • 10
4
votes
2 answers

NSButton in NSTableCellView: How to find desired objectValue?

I have a view-based NSTableView that is populated through bindings. My textFields & imageViews are bound to the NSTableCellView's objectValue's properties. If I want to have an edit/info button in my NSTableCellView: Who should be the target of…
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
2 answers

Referencing Bindings in Connections Inspector

I'm new to Xcode 4.2, and I have a sample code from Apple, and I'm playing with it to make myself familiar with Xcode. I made a similar project with that of Apple's, and one button of my project (in Connections Inspector), has less options in…
Mike
  • 43
  • 1
  • 3
4
votes
1 answer

Circular dependencies in Cocoa bindings

This is doing my head in... Simplified version: I have two text fields - Field A and Field B. Field B can be derived from field A and similarly Field B can be derived from Field A. (There's couple of other fields that in combination with either A or…
rytis
  • 2,649
  • 22
  • 27
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
2 answers

How to retrieve NSCollectionViewItems from a NSCollectionView

I just implemented an NSCollectionView just like the one described on the developer page and it work perfectly. Now, how can I access to collectionViewItems from CollectionView?
Giuseppe
  • 6,666
  • 2
  • 20
  • 32
4
votes
1 answer

NSCollectionView get selected item on button click

I have a NSCollectionView is bound to an NSArrayController that has an NSMutableArray as content. Items in the NSMutableArray are displayed as they should. I have an WindowController class that holds a reference to the NSMutableArray. There is also…
vidstige
  • 12,492
  • 9
  • 66
  • 110
4
votes
2 answers

Binding to a class method in Cocoa?

If I have a method like: @interface CharacterSet + (NSArray *)allCharacterSets; @end Can I bind to it using Cocoa bindings? I'm trying to hook up an NSComboBox's content values to it. When I enter CharacterSet.allCharacterSets into the "Model…
alexantd
  • 3,543
  • 3
  • 27
  • 41
4
votes
2 answers

New Core Data object doesn't show up in NSArrayController arrangedObjects

When I insert a new object in a Core Data managed object context and shortly after that try to find this new object in the NSArrayController (which is connect with the managedObjectContext through binding), I can't find it. I do the creation and…
brutella
  • 1,597
  • 13
  • 26