Skip to content

Instantly share code, notes, and snippets.

@jagbolanos
Created February 6, 2012 21:15
Show Gist options
  • Save jagbolanos/1754933 to your computer and use it in GitHub Desktop.
Save jagbolanos/1754933 to your computer and use it in GitHub Desktop.
TabBarViewController
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UITabBarController *tbc = [[UITabBarController alloc] init];
UINavigationController *nvc = [[UINavigationController alloc] init];
StreamViewController *vc = [[StreamViewController alloc] init];
vc.title = @"Vampire Or Not";
[nvc pushViewController:vc animated:NO];
nvc.title = @"Community";
nvc.tabBarItem.title = @"Community";
nvc.tabBarItem.image = [UIImage imageNamed:@"112-group"];
UINavigationController *mynvc = [[UINavigationController alloc] init];
StreamViewController *myvc = [[StreamViewController alloc] init];
myvc.title = @"Vampire Or Not";
myvc.filterByUser = YES;
[mynvc pushViewController:myvc animated:NO];
mynvc.title = @"My Photos";
mynvc.tabBarItem.title = @"My Photos";
mynvc.tabBarItem.image = [UIImage imageNamed:@"201-vampire"];
[tbc setViewControllers:[NSArray arrayWithObjects:nvc, mynvc, nil]];
CGFloat width = 66, height = 66;
UIButton *takePicture = [[UIButton alloc] initWithFrame:CGRectMake(160-width/2., 480-height, width, height)];
[takePicture setImage:[UIImage imageNamed:@"camera_button_take"] forState:UIControlStateNormal];
[takePicture addTarget:self action:@selector(takePictureClicked:) forControlEvents:UIControlEventTouchUpInside];
[tbc.view addSubview:takePicture];
self.takePictureButton = takePicture;
[takePicture release];
self.window.rootViewController = tbc;
[vc release];
[nvc release];
[myvc release];
[mynvc release];
[tbc release];
[self.window makeKeyAndVisible];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment