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
14
votes
2 answers

How do I bind to a custom view in Cocoa using Xcode 4?

I'm a beginner when it comes to writing Mac apps and working with Cocoa, so please forgive my ignorance. I'm looking to create a custom view, that exposes some properties, which I can then bind to an NSObjectController. Since it's a custom view, the…
dbr
  • 487
  • 4
  • 10
13
votes
3 answers

How do I bind the enabled binding of a button to whether or not an NSArrayController has a selection?

I want to bind the enabled state of an NSButton to whether or not an NSArrayController has any selected items. How do I do this?
Redwood
  • 66,744
  • 41
  • 126
  • 187
13
votes
4 answers

What is the new way of binding an NSArrayController to the managed object context of a Core Data document?

Before Xcode went and added Storyboards for OS X apps you could connect an array controller to your document's managed object context by binding the Managed Object Context of the array controller to File's Owner with a Model Key Path of…
theMikeSwan
  • 4,739
  • 2
  • 31
  • 44
12
votes
3 answers

Swift Bindings won't work Xcode 6 Beta 5

I'm doing a simple test program using bindings in Swift on OSX. Having an NSTableView, NSArrayController and a model class I try to hook them up together, but without success! The build compiles but gives instantly this error: Thread 1:…
Nairam
  • 285
  • 4
  • 15
12
votes
5 answers

What's a good way to bind from a shared utility window and the frontmost document window?

I have an application which allows for multiple NSDocuments to be open. In this application is a single utility window that contains some functionality that I want to apply to the frontmost document. I am trying to use bindings here, so the trick…
danwood
  • 1,512
  • 1
  • 10
  • 27
12
votes
3 answers

NSOutlineView and NSTreeController example

Please send me some links on how to use NSOutlineView with NSTreeController bindings without using core data.
Bhanu
11
votes
5 answers

Separator item in NSPopupButton with bindings

The contents of a NSPopupButton are bound to an NSArray of strings. How can we insert a separator item via bindings? The "-" strings (like in the olden/Classic days) doesn't work, i.e. shows up literally as a "-" menu item. Is there any…
ATV
  • 4,116
  • 3
  • 23
  • 42
11
votes
2 answers

Binding an Ordered Relationship with an NSArrayController

How does one bind an NSArrayController's content to the entities in an ordered to-many relationship? I have an unordered to-many relationship in my Core Data model, and an NSArrayController whose Content Set is bound to that relationship from the…
Khakionion
  • 742
  • 7
  • 20
10
votes
7 answers

Should I use Cocoa bindings for my latest project?

I'm starting a project which I think would benefit from bindings (I've got a source list table, several browser views, etc), but I think it would also be quite doable, and perhaps more understandable, without them. From my limited experience I've…
Redwood
  • 66,744
  • 41
  • 126
  • 187
10
votes
6 answers

Cocoa Core Data newbie how-tos

I am one of the great unwashed masses of .NET developers keen to try their hands at Mac OS X development. At the moment I am trying to figure out the various elements of Cocoa and getting a bit stuck on Core Data. I noticed most of the documentation…
codedog
  • 2,488
  • 9
  • 38
  • 67
10
votes
1 answer

Editable table view bound to NSArrayController bound to NSUserDefaultsController

I have a simple model Foo that represents a user preference and encapsulates an NSString and an NSNumber. I want to store an array of Foo’s in user defaults so that they persist between launches of the application; and I’d like to display them in an…
9
votes
1 answer

How to bind NSTreeController's Children to Core Data ordered to-many-relationship?

Apple introduced ordered to-many-relationships in Core Data in Lion. I created an entity named TreeNode with an 1:1-object-relation, a 1:1-parent-relation and an ordered to-many-relationship children. Then I have an NSTreeController with the…
9
votes
2 answers

Setting up KVO for calculated values, based on calculated values

So I have two objects, Invoice and InvoiceLineItem. InvoiceLineItem has a property called cost and it is dynamically created based on other properties. To help with the KVO/bindings I use: + (NSSet *)keyPathsForValuesAffectingCost { return…
zorn
  • 438
  • 1
  • 5
  • 15
9
votes
3 answers

Sectioned NSTableView using NSArrayController

I'm trying to create a sectioned NSTableView using NSArrayController and cocoa bindings. I'm searching for a similar approach like with NSFetchedResultsController in iOS, where you can set a section key path. I want to make something similar with…
burki
  • 2,946
  • 6
  • 37
  • 51
9
votes
3 answers

Is there a way to set up a NSCollectionView programmatically in Swift?

I'm coming from the iOS development and I am wondering if there is a way to set up a NSCollectionView programmatically like a UICollectionView in iOS? And add the NSCollectionViewItems in code. Or is the only way to set up a NSCollectionView to use…
stefOCDP
  • 803
  • 2
  • 12
  • 20
1
2
3
64 65