Hi all, Im following through the book Cocoa Programming for Mac OSX and working on challenge Chapter 7. Key-Value Coding; Key-Value Observing. Im trying to bind the key value to the slider but i cant see the key value in the list. Here's my code:
@interface AppController : NSObject
{
int fido;
}
- (int)fido;
- (void)setFido
int)x;
@end
#import "AppController.h"
@implementation AppController
- (id)init
{
[super init];
[self setValue:[NSNumber numberWithInt:5]
forKey
"fido"];
NSNumber *n = [self valueForKey
"fido"];
NSLog(@"fido = %@", n);
return self;
}
- (int)fido
{
NSLog(@"-fido is returning %d", fido);
return fido;
}
- (void)setFido
int)x
{
NSLog(@"-setFido: is called with %d", x);
fido = x;
}
@end
So when i select the slider control, go to binding inspector and bind to my AppController i should see fido in the Model Key Path combo list but i can not. Can someone point out what the issue is here?
Cheers.
@interface AppController : NSObject
{
int fido;
}
- (int)fido;
- (void)setFido
@end
#import "AppController.h"
@implementation AppController
- (id)init
{
[super init];
[self setValue:[NSNumber numberWithInt:5]
forKey
NSNumber *n = [self valueForKey
NSLog(@"fido = %@", n);
return self;
}
- (int)fido
{
NSLog(@"-fido is returning %d", fido);
return fido;
}
- (void)setFido
{
NSLog(@"-setFido: is called with %d", x);
fido = x;
}
@end
So when i select the slider control, go to binding inspector and bind to my AppController i should see fido in the Model Key Path combo list but i can not. Can someone point out what the issue is here?
Cheers.