I’m using an NSViewController class with a single view in it to display a progress indicator bar and some text fields. I’m trying to use progressIndicator setMaxValue:and theTextField setStringValue: but neither of these are doing anything.
I’ve done this before and I’ve checked and rechecked, it’s fairly straightforward, the fact that it’s not working makes me think that it has to do with the fact that the class is NSViewController. Which is why I tried
Timers *aTimer = [[Timers alloc] init];
[aTimer.timerNameLabel setStringValue:@"name"];
[aTimer.progressIndicator setMaxValue:x];
in the app delegate which is an NSObject class, but that didn’t work either.
I’ve tried looking around the NSViewController documentation but I can’t find anything that says it can’t set those values so I don’t know what’s happening. What am I doing wrong?
You probably want to use
-initWithNibName:bundle:instead of a regularinitto initialize your custom nib.EDIT: It seemed the problem was due to the view not being queried before getting other objects. By calling
[myController view]you actually load the nib, which isn’t done automatically when you initialize the view controller. So before you can use any element of the view, you need to call[myController view]