views:

94

answers:

2

I have an application that I started with the Utility Application template. I'm using the Flipside for the Settings screen. I'm having the settings serialized to a file when the app is closed and deserialized when the app is opened. If there is no file to deserialize at startup, I want the flipside to be shown so the user can enter required information.

This is what I have:

- (void)viewDidLoad
{
    flipController = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil];
    flipController.delegate = self;
    flipController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

    if(![self deserialize])
    {
        [self showInfo];
    }
}

- (IBAction)showInfo
{       
    [self presentModalViewController:flipController animated:YES]; 
}

showInfo is the method that is called with the little 'i' button is pressed on the MainView. The button works, however my call in viewDidLoad doesn't.

I have run through my code with the debugger. [self deserialize] is returning NO and [self showInfo] is being called, and I checked if flipController is nil in that context, and it's not.

I've searched around and couldn't find anyone who's tried to do the same thing. I'm stumped to as why this isn't working. Anyone see what I'm doing wrong?

Thanks

+2  A: 

You might want to try moving your -showInfo call to your -viewDidAppear: method.

Ben Gottlieb
Perfect! Thanks a bunch for the quick response. It won't let me accept yet, but I will soon as the time limit has been reached.
Joel
Just a side-note. The viewDidAppear method gets called everytime the view switches back to that view. So I had to add to my if statement to make sure that method was called only once.
Joel
A: 

Yeah Im having the same problem. I don't want to have to use a counter with viewDidAppear cuz that seems kinda of cheating. Is there another way to do it? Why doesn't it work from viewDidLoad?

marty