This is the code that executes when a button is tapped in the view for the viewcontroller that displays the modal dialog:
-(IBAction)presentModally:(id)sender {
if (self.nvc == nil) {
MyModalViewController *vc = [[MyModalViewController alloc] init];
UINavigationController *navvc = [[UINavigationController alloc] initWithRootViewController:vc];
navvc.navigationItem.prompt = @"";
navvc.navigationBar.barStyle = UIBarStyleBlack;
[vc release];
self.nvc = navvc;
[navvc release];
}
}
[self presentModalViewController:self.nvc animated:YES];
This code should if everything was correct launch every time the view appear.
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"test");
}
When I comment the if-statement that checks if the Ivar is nil the method viewWillAppear is invoked. Any ideas?