Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

matthew858

macrumors member
Original poster
Apr 15, 2008
97
0
Sydney, Australia
I was looking at adding a tab bar object to TheElements sample code, but was wondering how to do it. I am trying to make a tab bar object called "First", so I made some .h and .m files called "FirstTabController". A added the header file to TheElementsAppDelegate, and I declared it in TheElementsAppDelegate.m the following way:
localNavigationController = [self createNavigationControllerWrappingViewControllerForDataSourceOfClass:[FirstTabController class]];
[localViewControllersArray addObject:localNavigationController];

[localNavigationController release];

Firstly, is this implementation all right?


In FirstTabController, I put the following code:

#import "FirstTabController.h"
#import "TheElementsAppDelegate.h"

@implementation FirstTabController;

- (NSString *)name {
return @"First";
}

- (NSString *)navigationBarName {
return @"First";
}

- (BOOL)showDisclosureIcon
{
return NO;
}
- (UIImage *)tabBarImage {
return [UIImage imageNamed:mad:"first.png"];
}
@end

What else do I have to do in order to get my tab to display and just display a blank view?

Thanks in advance!
 
OK, I have established that I need the following code in TheElementsAppDelegate.m if I want to show an empty view:
UIViewController * viewController = nil;
viewController = [[UIViewController alloc] init];

UIView * view = nil;
view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

viewController.view = view;
[view release];

UINavigationController * navigationController = nil;
navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
[viewController release];

[localViewControllersArray addObject:navigationController];
[navigationController release];

How can I implement this into a view controller subclass?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.