Hi guys,
I'm pretty new to Objective-C, XCode and Interface Builder and seem to be running into a little problem. I hope someone here on the forum will be able to help me out with this.
I have the following class :
I'm creating an instance of this class in my app controller and seem to be able to use it, since I can dump it to the NSLog and see the properties get updated, ...
My AppController looks like this :
And the Connect implementaion looks like this :
In the logIn implementation I'm setting the Secret string to something, which seems to be working since everything gets logged perfectly using NSLog. I connected the connect method to a button in Interface Builder, and that is working perfectly.
Now I'm wondering if there is some way I can bind the value of a Label to that secret property of my LoginClass ? I've been trying almost everything but can't seem to get it working.
I added an object in IB and set it to my LoginClass and tried to bind the value of the label to the secret key of that object, but that didn't seem to work (no errors, value simply doesn't get displayed).
Tried binding it to the AppController using LoginClass.secret as the key, but that doesn't seem to be working neither (no errors, value simply doesn't get displayed).
I'm probably doing something wrong, or am missing something, so I hope someone here will be able to help me out.
Thanks a lot in advance,
Stefaan
I'm pretty new to Objective-C, XCode and Interface Builder and seem to be running into a little problem. I hope someone here on the forum will be able to help me out with this.
I have the following class :
Code:
@interface LoginClass : NSObject
{
NSString *userName;
NSString *password;
NSString *secret;
BOOL connected;
}
- (void)logIn;
- (void)logOut;
- (id)initWithLogin:(NSString *)aLogin password:(NSString *)aPassword;
@property (readwrite, copy) NSString *userName;
@property (readwrite, copy) NSString *password;
@property (readonly) NSString *secret;
@property (readonly) BOOL connected;
I'm creating an instance of this class in my app controller and seem to be able to use it, since I can dump it to the NSLog and see the properties get updated, ...
My AppController looks like this :
Code:
@interface AppController : NSObject
{
IBOutlet NSTextField *userName;
IBOutlet NSTextField *password;
// IBOutlet NSTextField *secret;
IBOutlet NSWindow *window;
LoginClass * LoginClass;
}
- (IBAction)connect:(id)sender;
And the Connect implementaion looks like this :
Code:
- (IBAction)connect:(id)sender
{
// Create an instance of our LoginClass
LoginClass = [[LoginClass alloc] initWithLogin:[userName stringValue] password:[password stringValue]];
// Now that we have our LoginClass we can start to work with it.
[LoginClass logIn];
...
}
In the logIn implementation I'm setting the Secret string to something, which seems to be working since everything gets logged perfectly using NSLog. I connected the connect method to a button in Interface Builder, and that is working perfectly.
Now I'm wondering if there is some way I can bind the value of a Label to that secret property of my LoginClass ? I've been trying almost everything but can't seem to get it working.
I added an object in IB and set it to my LoginClass and tried to bind the value of the label to the secret key of that object, but that didn't seem to work (no errors, value simply doesn't get displayed).
Tried binding it to the AppController using LoginClass.secret as the key, but that doesn't seem to be working neither (no errors, value simply doesn't get displayed).
I'm probably doing something wrong, or am missing something, so I hope someone here will be able to help me out.
Thanks a lot in advance,
Stefaan