Search This Blog

Monday, March 22, 2010

Added buttons, webview, added outlets, but can't play with them in the code...

Programmer Question

Hi!



I made a toolbar with two buttons on it. I then created two outlets in my class controller. Then I hooked the the controller to the buttons and selected the outlets.



Finally I rewritten the class files (that added:



IBOutlet id next;
IBOutlet id previous;


to my .h file).



So now, everything looks okay. But then I try somewhere in the code to change the state of one of my button like this:



next.enabled = YES;


I tried with self. too but unfortunately I receive this error message:
error: request for member 'enabled' in something not a structure or union



Do you have any idea of what's happening there?



And yes I have:



#import <UIKit/UIKit.h>


:)



Using:



[next setEnabled:YES];


gives me no error but still doesn't work...



And finally, for documenting purposes here's the whole method:



- (void)viewDidLoad {
[super viewDidLoad];

if (!self.currentLevel) {
self.currentLevel = @"1";
}

NSArray *etape = [self.etapes objectForKey:self.currentLevel];
if ([etape count] > 0) {
self.navigationItem.title = [etape objectAtIndex:1];
if ([etape count] > 1) {
[next setEnabled:YES];
}

} else {
self.navigationItem.title = @"Aucune étape";
}
}


When I do:



NSLog(@"%@", [next class]);


It returns (null) ... I guess it is supposed to be UIBarButtonItem...



It seems that it is impossible to play with any outlets even if I don't receive any errors while playing with them...



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails