Saturday, 7 September 2013

Tab View initialization issues

Tab View initialization issues

I have a tab view, separating the tabs "Stopwatch" and Timer." These are
controlled by ClockViewController.m and h.
My issue is that the stopwatch is initializing just fine. My code for what
it should do when the program opens works. However, my code for the timer
does not.
Relevant code for ClockViewController.m:
Initializing ClockViewController:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle
*)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Initialization code here.
if (startedSW == FALSE)
{
[self initializeTimer:nil];
}
if (isTimerRunning == FALSE)
{
[self initializeStopwatch:nil];
}
}
return self;
}
initializeStopwatch (this one is the one that works fine):
- (void)initializeStopwatch:(id)sender
{
//Sets the timer to 0 all-around.
[lblSWTime setStringValue:@"XX:XX:XX"];
[lblTimeSinceLastLap setStringValue:@"00:00:00"];
}
initializeTimer (the non-working one):
- (void)initializeTimer:(id)sender
{
//Set up the panel to properly be ready to go.
[btnTimerPause setEnabled:NO];
[lblTimerTime setStringValue:@"59:59"];
[lblTimerTime setHidden:NO];
[lblTimerMillisecs setHidden:NO];
//Sets up the minutes pop-up button to have the correct options in it.
int minutesIntToAdd = 1;
NSString *minutesIntToAddString;
for (int i = 1; i < 60; i++)
{
//Adds 1-59 to the pop-up button.
minutesIntToAddString = [NSString stringWithFormat:@"%d",
minutesIntToAdd];
[btnMinutesButton addItemWithTitle:minutesIntToAddString];
minutesIntToAdd++;
}
//Sets up the seconds pop-up button to have the correct options in it.
int secondsIntToAdd = 1;
NSString *secondsIntToAddString;
for (int j = 1; j < 60; j++)
{
//Adds 1-59 to the pop-up button.
secondsIntToAddString = [NSString stringWithFormat:@"%d",
secondsIntToAdd];
[btnSecondsButton addItemWithTitle:secondsIntToAddString];
secondsIntToAdd++;
}
}
My issue is that none of the code in initializeTimer is working. It's not
running it when the xib is loaded / initialized.
I know this question is confusing, but any help would be appreciated.

No comments:

Post a Comment