Questions tagged [nsobjectcontroller]

NSObjectController is a Cocoa bindings-compatible controller class. Properties of the content object of instances of this class can be bound to user interface elements to access and modify their values.

NSObjectController is a Cocoa bindings-compatible controller class. Properties of the content object of instances of this class can be bound to user interface elements to access and modify their values.

By default, the content of an NSObjectController instance is an NSMutableDictionary object. This allows a single NSObjectController instance to be used to manage many different properties referenced by key-value paths. The default content object class can be changed by calling setObjectClass:, which subclasses must override. Your application should use a custom data class that is key-value compliant whenever possible.

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

How do I bind an NSTextField's value to an NSObjectController's content without errors?

I have a pretty simple set up here, and Xcode is giving me a comment-less red "!" mark in the interface builder. Started from a Core Data-based document template. The document xib has an NSObjectController instance, whose Managed Object Context is…
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
2 answers

Binding selection across multiple view controllers in a single window interface

I am having an issue wrapping my head around how to hook up a few NSArrayControllers across two view controllers. I want to sync the selection in the source list table view to update the values in the second detail view controller. I'm using the…
3
votes
1 answer

How to use NSObjectController with Core Data?

I have spent more than a day on trying to find a simple example of how to use an NSObjectController for binding along with core data. All examples are of NSArrayControllers with NSTableView bindings. How would you setup a simple NSObjectController…
Jason Blade
  • 373
  • 2
  • 4
  • 17
2
votes
0 answers

Binding a number to NSTextField with an NSObjectController, but cannot display

I am pretty new for cocoa programming. I am learning binding, trying to make a simple binding code as: - (void)awakeFromNib { self.aValue = [[Model alloc] init]; NSString *aKey = @"value"; NSDictionary *aDic =…
Herodazhu
  • 21
  • 1
1
vote
0 answers

What is the controller key "selection" and how does it get its default state?

I'm working on an app right now that needs to use bindings as glue code from the controller. I found this tutorial which bound an NSStepper and NSTextField to a model and it works fine. The problem is that I need to do this programmatically, but…
1
vote
0 answers

How to programmatically put an NSObjectController into entity mode?

I'm instantiating an NSTreeController programmatically and want to put it into entity mode, but regardless of what I do it sticks to class mode. The following code fragment doesn't work: NSTreeController *treeCon = [[NSTreeController…
Mojo66
  • 1,109
  • 12
  • 21
1
vote
1 answer

How to use NSObjectController and Managed Object Context using Cocoa Bindings

Searched entire Internet but couldn’t find the modern solution for my problem. I want to use NSObjectController in pair with Core Data through Cocoa Bindings and struggle to set it up properly. Worth noting that I’m using latest version of Xcode and…
1
vote
1 answer

How to use keyDown in NSObjectController

I'm developing an ap for MacOSX with Xcode5 my initial window is NSObjectController based, and I'm trying to capture keyboard events by using the common method I used on NSWindowControllers called -(void)keyDown:(NSEvent *)theEvent{} but this…
Jesus
  • 8,456
  • 4
  • 28
  • 40
1
vote
1 answer

How to be notified of any binding changes to an NSObjectController

I have an NSView which in which all the controls have been bound to a model object using an NSObjectController in Interface Builder. This works correctly. Now I would like my NSViewController to be notified whenever there's a change to any of those…
tarmes
  • 15,366
  • 10
  • 53
  • 87
1
vote
2 answers

When is a NSManagedObject really accessible?

I have a problem. I have an NSObjectController called "mapController" and I want to put some defaults when the object is created. I do this inside the windowControllerDidLoadNib method of my document, as suggested by the docs. But… if…
berfis
  • 417
  • 4
  • 17
0
votes
1 answer

Core Data: Instantiating a "root object" in a document based application

I am creating a document based project using Core Data and have run into what may simply be a conceptual issue for me, as while I am not new to Cocoa, this is my first attempt to utilize Core Data. What I am trying to accomplish should be…
kcalvelli
  • 1
  • 1
0
votes
1 answer

NSObjectController in object mode in Swift

How do I configure an NSObjectController in object mode in Swift? Let's say I have a class A: class A {} Here's what I have tried: let oc = NSObjectController() oc.objectClass = A.self oc.newObject() // error The last line produces an…
mistercake
  • 692
  • 5
  • 14
0
votes
1 answer

Why NSObjectController does not update the model property it is bound to?

I configure bindings like this: @property (nonatomic, copy) NSString *name; @property (nonatomic, strong) NSObjectController *controller; ... self.controller = [[NSObjectController alloc] initWithContent:nil]; [self.controller…
Vadim
  • 9,383
  • 7
  • 36
  • 58
1
2