xcode 4.2 How to add Tab Bar subproject it?
Thank you first
Reply:
Reply:
I'll give you an example: - (id) initWithNibName: (NSString *) nibNameOrNil bundle: (NSBundle *) nibBundleOrNil
{
if (self = [super initWithNibName: nil bundle: nil]) {
/ / TabBar1
FirstTabBar * tab1 = [[[FirstTabBar alloc] init] autorelease];
tab1.tabBarItem = [[[UITabBarItem alloc] initWithTitle: @ "FirstTabBar"
image: nil
tag: 0] autorelease];
tab1.tabBarItem.image = [UIImage imageNamed: @ "icon_map.png"];
UINavigationController * tab1Nav = [[[UINavigationController alloc] init] autorelease];
[Tab1Nav pushViewController: tab1 animated: NO];
/ / TabBar2
SecondTabBar * tab2 = [[[SecondTabBar alloc] init] autorelease];
tab2.tabBarItem = [[[UITabBarItem alloc] initWithTitle: @ "SecondTabBar"
image: nil
tag: 0] autorelease];
tab2.tabBarItem.image = [UIImage imageNamed: @ "icon_search.png"];
/ / TabBar3
ThreeTabBar * tab3 = [[[ThreeTabBar alloc] init] autorelease];
tab3.tabBarItem = [[[UITabBarItem alloc] initWithTitle: @ "ThreeTabBar"
image: nil
tag: 0] autorelease];
tab3.tabBarItem.image = [UIImage imageNamed: @ "icon_list.png"];
/ / TabBar4
FourTabBar * tab4 = [[[FourTabBar alloc] init] autorelease];
tab4.tabBarItem = [[[UITabBarItem alloc] initWithTitle: @ "FourTabBar"
image: nil
tag: 0] autorelease];
tab4.tabBarItem.image = [UIImage imageNamed: @ "icon_twitter.png"];
/ / Assembly TabBar
self.viewControllers = [NSArray arrayWithObjects: tab1Nav, tab2, tab3, tab4, nil];
}
return self;
}
No comments:
Post a Comment