Hi folks,
I'm trying to implement a simple object bridge in cocoa where the bridge object acts as a kvo/bindings-compliant drop in for some arbitrary other NSObject instance.
Here is my problem (more details in the code below):
A bridge object acts as a drop in for a Person-Object, with an NSString* property called name and an Address...
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 is how to cleanly bind the user interface of the utility window to the frontmost document....
I've got an NSArrayController, and I'm using KVO to observe the Old/New values of it's selection method.
This works perfectly (triggers when the selection changes, the usual) except that the items in the change dictionary are all null instead of being the old/new selected object. [arrayController selection] still returns the proper obje...
A class has a property (and instance var) of type NSMutableArray with synthesized accessors (via @property). If you observe this array using:
[myObj addObserver:self forKeyPath:@"theArray" options:0 context:NULL];
And then insert an object in the array like this:
[[myObj theArray] addObject:[NSString string]];
An observeValueForKey...
Hi all!
I have a problem redrawing a custom view in simple cocoa application. Drawing is based on one parameter that is being changed by a simple NSSlider. However, although i implement -setParameter: and -parameter methods and bind slider's value to that parameter in interface builder i cannot seem to make a custom view to redraw itsel...
Hi everyone,
I'd appreciate some feedback on a particular approach I'm thinking of using. The scenario is below.
I have an object (lets call it MObject) that has a number of properties, say, x and y coordinates, height and width. The properties are named according to the KVC guidelines (MObject.x; MObject.height, etc). My next task, is...
I need to keep an NSPathControl updated with the currently selected path in an NSBrowser, but I'm having trouble figuring out a way of getting notifications when the path has changed from the NSBrowser. The ideal way to do this would just to be to observe the path key path in the NSBrowser, but that gives a KVO can only observe set<key> ...
I had a straight forward approach of turning Key/Value pairs of an XML excerpt into an NSDictionary when I started a simple iPhone application. The problem is, I need to turn those NSDictionary's instances that once populated my UITableView's into custom classes because they require behavior and additional complexity. The problem here is...
I have an object which straight forward instance variables. Some are NSString, some are unsigned ints, etc. I was under the impression Key-Value coding was scriptable in that I could write code such as the following:
id key, value;
key = [[attributes objectAtIndex:j] name];
value = [[attributes objectAtIndex:j] stringValue...
In IB it is easy to bind a label or text field to some controller's keyPath.
The NSDockTile (available via [[NSApp dockTile] setBadgeLabel:@"123"]) doesn't appear in IB, and I cannot figure out how to programmatically bind its "badgeLabel" property like you might bind a label/textfield/table column.
Any ideas?
...
I am trying to get key-value-observing to work for an NSMutableArray. Below is the .h file for MyObservee, the observed class:
@interface MyObservee : NSObject {
@private int someValue;
@private NSMutableArray *someArray;
}
@property (readwrite,assign) int someValue;
- (NSMutableArray *)someArray;
@end
The class MyObserver im...
Hey guys! =)
I've created in my CoreData app an entity with some attributes. Imagine a tableview and a bound NSArrayController. With both I create (and edit) my entity "instances". My question is how I can get the values of these attributes to my code. If there are more questions: http://twitter.com/xP_ablo
...
I have an object that implements the indexed accessor methods for a key called contents. In those accessors, I call willChange:valuesAtIndexes:forKey: and didChange:valuesAtIndexes:forKey: when I modify the underlying array.
I also have a custom view object that is bound to contents via an NSArrayController. In observeValueForKeyPath:of...
I've attempted to observe the (readonly) visibileViewController property of a UINavigationController with no success. I was able to successfully observe a readwrite property I defined myself for testing purposes on another class.
Is it possible to observer readonly attributes?
...
Hi Stack Overflow Gang,
Being new to objective-c, cocoa, and iPhone dev in general, I have a strong desire to get the most out of the language and the frameworks.
One of the resources I'm using is Stanford's CS193P class notes that they have left on the web. It includes lecture notes, assignments and sample code, and since the course ...
Let's say I want to observe the hidden property on UIView:
@property(nonatomic, getter=isHidden) BOOL hidden
Do I add an observer for the keypath hidden or isHidden?
...
I can't find in the Docs where they explain all those fields and what they mean. Especially "Controller Key" is not clear to me.
...
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 [NSSet setWithObjects:@"lineItemType", @"serviceCost", @"hourlyRate", @"timeInSeconds", @"prod...
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 arrangedObjects.command shows just "(" -- presumably it's trying to show a multi-line string with comma-separat...
I have a simple protocol with a property:
@protocol StopsSource <NSObject>
@property (retain,readonly) NSArray * stops;
@end
I'm adding a key-value observer elsewhere to listen to changes to the "stops" property:
id<StopsSource> source = ...
[source addObserver:self
forKeyPath:@"stops"
options:NSKeyValueObserving...