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

Manual Cocoa Binding not changing Observed KeyPath

I'm changing a cocoa binding programatically. I'm binding a NSTextField's value to the selection of an ArrayController. After I manually change the binding, I'm getting the "not key-value coding compliant for the key.." error, with the key being…
Woodster
  • 3,451
  • 3
  • 17
  • 19
5
votes
1 answer

Data-binding in a NSCollectionView

I've got a NSCollectionView for which I do have a dataArray and a selectedIndexes NSIndexSet defined in it's File's Owner. (Since I'm working with MonoMac on that project I've had some trouble working with a simple NSArrayController and so I decided…
flohei
  • 5,248
  • 10
  • 36
  • 61
5
votes
3 answers

Animating setHidden: on NSView via Cocoa bindings

I'm currently putting the final touches on a project. A lot (if not all) of the UI logic currently relies on Cocoa Bindings. Some of the user interface elements (labels, buttons, etc.) have their "Hidden" bindings defined. When certain events are…
5
votes
1 answer

Cocoa NSTextField Drag & Drop Requires Subclass... Really?

Until today, I've never had occasion to use anything other than an NSWindow itself as an NSDraggingDestination. When using a window as a one-size-fits-all drag destination, the NSWindow will pass those messages on to its delegate, allowing you to…
ipmcc
  • 29,581
  • 5
  • 84
  • 147
5
votes
1 answer

MVC and cocoa bindings best practices question

Lets say I have a view, myView, a view controller, myViewController, and some sort of model object, myModel. Further, lets say the model has two KVO compliant properties, arrayOfPeopleNames and arrayOfAnimalKinds (both NSStrings). In my view I want…
Redwood
  • 66,744
  • 41
  • 126
  • 187
5
votes
1 answer

How do you bind a storyboard view to a Core Data entity when using NSDocument?

I'm building an OS X app that uses core data, NSDocument, storyboards, and Cocoa bindings. My expectation is that the following occurs: An instance of MyDocument (NSDocument subclass) is created. MyDocument creates a Core Data…
Bob Whiteman
  • 2,481
  • 2
  • 23
  • 27
5
votes
1 answer

10.11 NSCollectionView: "could not load the nibName: NSCollectionViewItem in bundle NSBundle"

I want to use a NSCollectionView with the new API model from Swift according to https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKit/#10_11CollectionView. Since I prefer doing as much as possible in IB, I want to use the Content…
Etan
  • 17,014
  • 17
  • 89
  • 148
5
votes
2 answers

How can I make a button inside a NSTableViewRow respond to the represented object

I've been fighting with this problem for quite some time. I'm working on a file copy manager module, so far I have been able to make everything work perfectly with the exception of the cancel button. For some reason when I click the cancel button…
larod
  • 435
  • 3
  • 11
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
0 answers

Should I need to unbind cocoa-bindings in dealloc of windowController?

I have window controller and view controller that use core data bindings, but I want to be able to have those views really, truly get deallocated. I then want to reset the managedObjectContext and at that point have given up as much memory as…
5
votes
3 answers

Aaron Hillegass _Cocoa Programming for Mac OS X_ Chapter 9 Question

In Aaron Hillegass' Cocoa Programming for Mac OS X, Chapter 9, the section called "Begin Editing on Insert", he explains how to do exactly that. The thing that confused me though, was that he did a bunch of other stuff. Here's the full code…
chrisgoyal
  • 4,297
  • 4
  • 22
  • 27
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

Tool for debugging KVO/Bindings in Cocoa

Is there any tool to log current observers of a given object, in the spirit of what "gdb info gc-roots" does? I found "gdb info gc-references" could do that (sort of) as a by-product of its original purpose, but that won't work with non garbage…
user248876
5
votes
2 answers

How to force-update Cocoa bindings?

I'm using Cocoa bindings (as in Objective-C on the Mac) to display a relative date value using a value transformer. That is, my NSValueTransformer subclass converts an NSDate instance to NSString to display relative dates like "3 seconds ago", "2…
adib
  • 8,285
  • 6
  • 52
  • 91