Hi there,
I am currently working on an application in which I am making a catalogue that will contain different products. So far I have made my startup menu, which includes three buttons (one for the catalogue, one for settings and one for instructions). When pressing the catalogue button, the app switches to the CatalogueViewController, and it is from within this ViewController that the catalogue should start.
Besides the startup menu, I have written the app for the catalogue in another separate app. The catalogue app is made with a TabBarController, while the startup menu is made with regular ViewControllers. My next step is to combine these two applications, so that when the catalogue button is pressed, it should open the catalogue.
Until now, when I press the catalogue button, I create an instance of my UICatalogueTableViewController which is a subclass of UITableViewController, and load my CatalogueView.xib along with it.
The ViewController header file that manages which view to be displayed:
@class MenuViewController;
@class UICatalogueTableViewController;
@class SettingsViewController;
@class InstructionsViewController;
@interface IkeaViewController : UIViewController {
MenuViewController *menuViewController;
UICatalogueTableViewController *catalogueViewController;
SettingsViewController *settingsViewController;
InstructionsViewController *instructionsViewController;
}
@property (retain, nonatomic) MenuViewController *menuViewController;
@property (retain, nonatomic) UICatalogueTableViewController *catalogueViewController;
@property (retain, nonatomic) SettingsViewController *settingsViewController;
@property (retain, nonatomic) InstructionsViewController *instructionsViewController;
-(IBAction)catalogueButtonPressed:(id)sender;
-(IBAction)settingsButtonPressed:(id)sender;
-(IBAction)instructionsButtonPressed:(id)sender;
@end
The method that is called when pressing the catalogue button:
- (IBAction)catalogueButtonPressed:(id)sender{
if (self.catalogueViewController.view.superview == nil) {
if (self.catalogueViewController == nil) {
UICatalogueTableViewController *catalogueController = [[UICatalogueTableViewController alloc]initWithNibName:@"CatalogueView" bundle:nil];
self.catalogueViewController = catalogueController;
[catalogueController release];
}
[menuViewController.view removeFromSuperview];
[self.view addSubview:catalogueViewController.view];
}
}
Inside my .xib file (CatalogueView.xib) I have created a TabBarController object, and my files owner has its class identity set to UICatalogueTableViewController but I can't seem to connect the two, so that the TabBarController is displayed when running the app. The files owner requires a view.
When pressing the settings or instructions button in my startup menu, there is no problem when instantiating their ViewController and loading the .xib files, because they only contain a single view to be displayed.
How do I go from my startup menu (a regular ViewController) to my catalogue (TabBarController)?
Thanks in advance.