My FlipViewController has some setting in form of UISwitches for MainViewController. I am trying to set those settings (based on variables) when FlipViewController is loaded and save those settings when MainViewController is loaded back (from FlipView controller). Something is funky and i can’t get it to work consistently.
It looks like when i call FlipViewController from MainViewController, FlipView is loaded before i can set the states of the switches in FlipView. How can i accomplish doing this?
Thanks in advance!
Vatsal
Function within MainViewController
// called when the user touches the info button
- (IBAction)showInfo
{
// create a new FlipsideViewController
FlipsideViewController *controller = [[FlipsideViewController alloc]
initWithNibName:@"FlipsideView" bundle:nil];
controller.delegate = self; // set the delegate
// set the animation style to a horizontal flip
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// show the flipside of the app
[self presentModalViewController:controller animated:YES];
// set the controls on the flipside
[controller setSwitches]; // set each region's switch
//[controller setSelectedIndex:guessRows - 1]; // set number of choices
controller.wordsDatabase=self.wordsDatabase;
[controller release]; // release the controller FlipsideViewController
} // end method showInfo
Function setting up switches in FlipView Controller (Called in MainView controller)
-(void) setSwitches
{
}
Looks to me like your
FlipSideViewController‘ssetSwtichesmethod is called before you’ve assigned the controller a reference to thewordsDatabase.ex:
should be: