In short, how can i manage to load a SPECIFIC uiview from a set of UIViews all contained in one XIB file? iboutlets? how?
In some cases i would like the first view displayed instead of the 2nd, sometimes i want the 3rd displayed instead of the 1st. they are all similar UIViews however only one can be displayed MODALLY presented.. I know which UIView to display depending on the user interaction with buttons being clicked.. however the question is how can i specifically select a certain view to be displayed and then attach it modally to present it.
In detail this is what i have done so far:
Hi, I have three view objects inside my TestViewController.xib file like so:
This xib's 'File's Owner' is connected to a TestViewController class.
On run time i am programatically instantiating the TeamViewController class like so:
TestViewController *tVController = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:nil];
I then present the view modally like so:
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:ls];
[nav setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[nav setModalPresentationStyle:UIModalPresentationFormSheet];
nav.navigationBar.tintColor = [UIColor blackColor];
[nav setNavigationBarHidden:YES];
[rootViewController.navigationController presentModalViewController:nav animated:YES];
nav.view.backgroundColor = [UIColor blackColor];
self.modalNavController = nav;
[nav release];
[tVController release];
This all works and my view is loaded, however it only loads one of the views by default - automatically. What i would like to do is to be able to know how to load only a SPECIFIC UIView when instantiating the TestViewController. One way i thought of achieving this was to create IBOutlets for them and managing which view is displayed like that? so I have created three IBOutlets within the class and then connected them from the Xib's fileown to each UIView. This connected all fine.
IBOutlet *view1;
IBOutlet *view2;
IBOutlet *view3;
I am able to do something like this:
[self.view addSubview:view2];
and this will display view2 properly, however not in the modal view as i would ideally like it when instantiating TestViewController.
Can anyone guide me in how to achieve this goal of mine?
Thanks