Skip to content

Instantly share code, notes, and snippets.

@xdream86
Created August 26, 2013 08:30
Show Gist options
  • Save xdream86/6339218 to your computer and use it in GitHub Desktop.
Save xdream86/6339218 to your computer and use it in GitHub Desktop.
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// 拼车族导航
CarSharingViewController* carSharingViewController = [[CarSharingViewController alloc] init];
UINavigationController* mainNav = [[UINavigationController alloc] initWithRootViewController:carSharingViewController];
UIImage *image = [UIImage imageNamed:@"CarSharingNavBG.png"];
[mainNav.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
// 立即用车导航
UIImage *navBarImage = [UIImage imageNamed:@"nav-bar.png"];
getTaxiHistoryViewController* immediateUseViewController = [[getTaxiHistoryViewController alloc] init];
UINavigationController* immediateCarNav = [[UINavigationController alloc] initWithRootViewController:immediateUseViewController];
[immediateCarNav.navigationBar setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
// 预定用车导航
orderHistoryViewController* reservedTaxiViewController = [[orderHistoryViewController alloc] init];
UINavigationController* reservedTaxiNav = [[UINavigationController alloc] initWithRootViewController:reservedTaxiViewController];
[reservedTaxiNav.navigationBar setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
// 我的订单导航
PassengerOrderCenterViewController* myOrderViewController = [PassengerOrderCenterViewController defaultInfoCenter];
MyNavController* myOrderNav = [[MyNavController alloc] initWithRootViewController:myOrderViewController];
[myOrderNav.navigationBar setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
// 设置导航
SetViewController* settingViewController = [[SetViewController alloc] init];
UINavigationController* settingNav = [[UINavigationController alloc] initWithRootViewController:settingViewController];
[settingNav.navigationBar setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];
self.delegate = self;
self.viewControllers = [[NSArray alloc] initWithObjects:mainNav, immediateCarNav, reservedTaxiNav, myOrderNav, settingNav, nil];
self.tabBar.backgroundImage = [UIImage imageNamed:@"tabbarBG.png"];
self.tabBar.selectionIndicatorImage = [UIImage imageNamed:@"selectedItem.png"];
[[UITabBarItem appearance] setTitleTextAttributes:@{ UITextAttributeTextColor : COLOR(32, 149, 188) }
forState:UIControlStateSelected];
}
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
if (item == [tabBar.items objectAtIndex:3]) {
[[PassengerOrderCenterViewController defaultInfoCenter] clearAllAlert];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment