views:

99

answers:

1

I have a UIView that is pushing a UITableViewController that is contained inside of a UITabBarController.

#import <UIKit/UIKit.h>


@interface ARViewController : UITableViewController<UITabBarControllerDelegate> {
    IBOutlet    UITabBarController*     tabBarController;

}

@property(nonatomic,retain)IBOutlet UITabBarController* tabBarController;

@end

Here is my implementation

- (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    self.clearsSelectionOnViewWillAppear = NO;
    self.title = @"AR";

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    tabBarController.delegate = self;
    [self.view addSubview:tabBarController.view];
}

My UITabBarController is referenced to Files Owner. Why is it not appearing?

A: 

UITabBarController is always used as 'root controller'. Maybe you can try to use a root controller to contain a tableview. And it's not a common method to add a tabbar as a subview to a tableview.

Elliot Chen
Can you explain "root controller" to me? How can I use a root controller to contain a tableview?
Sheehan Alam
RootController is something like views container used to organize other views. Mostly iphone app use NavigationController and TabBarController to organize other views, that's very convenient. For using a tabbar controller, you can easily drag a 'UITabBarController' into your Mainwindow.xib via Interface Builder, check that controller, you can find many interesting settings and easy to find where to 'insert' your UITableViewController into that UITabBarControlle.I suggest you the book 'Begin iPhone development' written by Dave Mark and Jeff LaMarche. A great book.
Elliot Chen