EDIT Let me simplify the question: Suppose your application has two views, the home view and a tabbed view with 3 tabs. The home view has three standard buttons named "Tab1", "Tab2" and "Tab3". When you click on "Tab1", the tabbed view should be opened with tab 1 selected and the same goes for Tab2 and Tab3.
Any hints?
/EDIT
What I'm trying to do: when my iPhone app initializes, it displays a view with one button. When I click this button, it should go to a tabbed view.
The way I'm doing and it's not working (getting an uncaught exception): I started by creating a project from the view-based template. On the view controller that was auto-created, I've declared another view controller called TabbedViewController. Here's the header file:
#import <UIKit/UIKit.h>
@class TabbedViewController;
@interface DZBluePagesViewController : UIViewController {
TabbedViewController *tabbedViewController;
}
@property (nonatomic, retain) TabbedViewController *tabbedViewController;
-(IBAction)goToTabbedView:(id)sender;
@end
I've created a xib called TabbedView
and set the class identity of the file owner to the TabbedViewController. I've also dragged a Tab Bar Controller to it.
I've added a button on the home view and here's the action that I've associated with it on the main view controller file:
- (void)viewDidLoad {
TabbedViewController *tvc = [[TabbedViewController alloc]
initWithNibName:@"TabbedView" bundle:nil];
self.tabbedViewController = tvc;
[tvc release];
[super viewDidLoad];
}
-(IBAction)goToTabbedView:(id)sender {
// [self.view removeFromSuperview];
[self.view insertSubview:tabbedViewController.view atIndex:0];
}
I'm getting an uncaught exception on the insertSubview call... I've done 3 or 4 tutorials (from the iPhone Development - Mark and LaMarche - book) on multiview apps so far and I thought I was ready to do one without anyone holding my hands... obviously wrong. Anybody can help?