0

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

Joel
  • 16,474
  • 17
  • 72
  • 93

1 Answers1

2

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

Ben Gottlieb
  • 85,404
  • 22
  • 176
  • 172
  • 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 Mar 29 '10 at 20:25
  • 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 Mar 29 '10 at 20:38
  • when viewDidLoad is called, your view has not yet been added to the view hierarchy, and, potentially, you've not yet been added to a parent view controller. – Ben Gottlieb Jan 09 '11 at 15:22