I've set up a notification added to a NSButton:
Class X
post notification:
[[NSNotificationCenter defaultCenter] postNotificationName:@"cbCheckBoxEntred" object:nil];
Class Y
setup observer:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(doMyStuff:)
name:@"cbCheckBoxEntred" object:nil];
calling the method:
- (void)doMyStuff:(NSNotification *)note {
NSString *myImagePathStr = [tfImagePath stringValue];
justAnotherObjCclass *icmjustAnotherObjCclass = [[justAnotherObjCclass alloc] init];
NSImage* myImage = [icmjustAnotherObjCclass convertImage:myImagePathStr];
}
The method: doMyStuff is called as expected
BUT the function:
NSString *myImagePathStr = [tfImagePath stringValue];
returns allways nil
similar functions in the method "convertImage" called from another class:
NSImage* myImage = [icmjustAnotherObjCclass convertImage:myImagePathStr];
are also returning nil
What am I doing wrong ?
Can someone assist me ?
>> If you have an idea of the cause, it should be very helpfull anyway.
Only a guess, that somehow you have two instances of the Y view, one that the user can see where the string was typed, and the other hidden (or behind it, or the wrong size, or the wrong position, or whatever) where its text field remains empty.
There are a couple of ways this can happen by accident, and it's not easy to tell that there are 2 views instead of only one.