// // untitled.m // // // Created by Trevor Rudolph on 5/3/13. // Copyright 2013 TrevorApps. All rights reserved. // #import "untitled.h" @implementation untitled @synthesize tabBar; @synthesize Item0; @synthesize Item1; @synthesize Item2; @synthesize Item3; @synthesize Item4; #pragma mark UITabBarDelegate methods - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item { switch (item.tag) { case 0: NSLog(@"0"); break; case 1: break; case 2: NSLog(@"2"); break; case 3: NSLog(@"3"); break; case 4: NSLog(@"4"); break; default: break; } NSLog(@"didSelectItem: %d", item.tag); } #pragma mark UIWebViewDelegate methods - (void)loadView { tabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0, 430, 320, 50)]; tabBar.delegate = self; [self.view addSubview:tabBar]; NSMutableArray *tabBarItems = [[NSMutableArray alloc] init]; Item0 = [[UITabBarItem alloc] initWithTitle:@"Home" image:[UIImage imageNamed:@"home.png"] tag:0]; Item1 = [[UITabBarItem alloc] initWithTitle:@"Quests" image:[UIImage imageNamed:@"missions.png"] tag:1]; Item2 = [[UITabBarItem alloc] initWithTitle:@"Battle" image:[UIImage imageNamed:@"attack.png"] tag:2]; Item3 = [[UITabBarItem alloc] initWithTitle:@"Armory" image:[UIImage imageNamed:@"equipment.png"] tag:3]; Item4 = [[UITabBarItem alloc] initWithTitle:@"Recuit" image:[UIImage imageNamed:@"recruit.png"] tag:4]; [tabBarItems addObject:Item0]; [tabBarItems addObject:Item1]; [tabBarItems addObject:Item2]; [tabBarItems addObject:Item3]; [tabBarItems addObject:Item4]; tabBar.items = tabBarItems; tabBar.selectedItem = [tabBarItems objectAtIndex:0]; } @end