Hallo Götter der Sonne,
Problemstellung:
Habe eine NSTableView. Jede "Zeile" repräsentiert eine Stofftüte. Jede Stofftüte kann ein Bild (hasImage) haben und einen Sound (hasSound). Nun möchte ich eine Spalte in der TableView haben, die mir ein kleines Bild malt, falls die entsprechende Stofftüte ein Bild und/oder einen Sound hat - also praktisch eine kleine "Statusanzeige".
Nun nichts leichert als das - NSCell-Subclass gezaubert und zwei bindings exposed:
Die dataCell der Spalte binde ich im Code.
Starte ich die Anwendung erhalte ich folgenden Fehler:
Ich weiß auch schon an was das liegt - in meinem NSCell subclass:
Alles anzeigen
Wieso?
Problemstellung:
Habe eine NSTableView. Jede "Zeile" repräsentiert eine Stofftüte. Jede Stofftüte kann ein Bild (hasImage) haben und einen Sound (hasSound). Nun möchte ich eine Spalte in der TableView haben, die mir ein kleines Bild malt, falls die entsprechende Stofftüte ein Bild und/oder einen Sound hat - also praktisch eine kleine "Statusanzeige".
Nun nichts leichert als das - NSCell-Subclass gezaubert und zwei bindings exposed:
Die dataCell der Spalte binde ich im Code.
Starte ich die Anwendung erhalte ich folgenden Fehler:
Quellcode
- 2007-01-04 23:34:11.452 Ebbinghaus[3564] *** -[NSCFArray charValue]: selector not recognized [self = 0x331f60]
- 2007-01-04 23:34:11.453 Ebbinghaus[3564] *** NSRunLoop ignoring exception '*** -[NSCFArray charValue]: selector not recognized [self = 0x331f60]' that raised during posting of delayed perform with target 3a6980 and selector 'reconfigureCardsTableView:'
- 2007-01-04 23:34:11.461 Ebbinghaus[3564] *** -[NSCFArray charValue]: selector not recognized [self = 0x3f4b70]
- 2007-01-04 23:34:11.461 Ebbinghaus[3564] *** NSRunLoop ignoring exception '*** -[NSCFArray charValue]: selector not recognized [self = 0x3f4b70]' that raised during posting of delayed perform with target 3a6980 and selector 'delayedSetup'
Ich weiß auch schon an was das liegt - in meinem NSCell subclass:
Quellcode
- static void *HasImageObservationContext = (void *)2091;
- static void *HasSoundObservationContext = (void *)2092;
- @implementation CKMediaCell
- [...]
- - (void)bind:(NSString *)bindingName toObject:(id)observableController withKeyPath:(NSString *)keyPath options:(NSDictionary *)options
- {
- if ([bindingName isEqualToString:@"hasImage"]) {
- [observableController addObserver:self forKeyPath:keyPath options:nilcontext:HasImageObservationContext];
- }
- if ([bindingName isEqualToString:@"hasSound"]){
- [observableController addObserver:self forKeyPath:keyPath options:nil context:HasSoundObservationContext];
- }
- // DARAN:
- [super bind:bindingName toObject:observableController withKeyPath:keyPath options:options];
- }
- - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
- {
- if (context == HasImageObservationContext) {
- [self setHasImage:YES];
- }
- if(context == HasSoundObservationContext) {
- [self setHasSound:YES];
- }
- }
Wieso?
Die Objective-Cloud ist fertig wenn sie fertig ist. Beta heißt Beta.
Objective-C und Cocoa Band 2: Fortgeschrittene
Cocoa/Objective-C Seminare von [co coa:ding].
Objective-C und Cocoa Band 2: Fortgeschrittene
Cocoa/Objective-C Seminare von [co coa:ding].