Dockyard > Objective-C Classes > NSString Additions

NSString Additions

Class Description


NSString now supports KVO! Using the key @"string" will work for both mutable and immutable strings, thanks to this simple category. Works with Cocoa Bindings too!

Methods


Accessing the string

- string

Overriden KVO methods

- addObserver:forKeyPath:options:context:

Method Detail


addObserver:forKeyPath:options:context:

- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context

The normal KVO methods change the class of the observed object as soon as an observer is added. Because NSString is toll-free bridged with CFString, this causes serious problems on pre-10.4 systems (I don't really know why). This makes sure that any string's class will stay the same even after an observer has been added.

string

- (NSString *)string

Returns an autoreleased copy of this string, suitable for KVC purposes.

This page was generated with DocYouMeant, a program created by Belkadan Software

Valid XHTML 1.0! Valid CSS!