//UISegmentedControl
NSArray *arr = [NSArray arrayWithObjects:@"逛街", @"主题", @"抢拍", nil];
self.headsegment = [[UISegmentedControl alloc] initWithItems:arr];
self.headsegment.frame = CGRectMake(0, 0, 90, 30);
self.headsegment.tintColor = [UIColor cyanColor];
self.navigationItem.titleView = self.headsegment;
[self.headsegment addTarget:self action:@selector(click:) forControlEvents:UIControlEventValueChanged];
[self.headsegment release];
//UITabBarController
MainViewController *main = [[MainViewController alloc] init];
main.title = @"购物";[main.tabBarItem initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:4];
SecondViewController *second = [[SecondViewController alloc] init];
second.title = @"婚博汇";
ThirdViewController *third = [[ThirdViewController alloc] init];
third.title = @"请帖";
FourViewController *four = [[FourViewController alloc] init];
four.title = @"故事";
FiveViewController *five = [[FiveViewController alloc] init];
five.title = @"我的";
UINavigationController *first = [[UINavigationController alloc] initWithRootViewController:main];
UINavigationController *secondVC = [[UINavigationController alloc] initWithRootViewController:second];
UINavigationController *thirdVC = [[UINavigationController alloc] initWithRootViewController:third];
UINavigationController *fourVC = [[UINavigationController alloc] initWithRootViewController:four];
UINavigationController *fiveVC = [[UINavigationController alloc] initWithRootViewController:five];
//
NSArray *arr = [NSArray arrayWithObjects:first, secondVC, thirdVC, fourVC, fiveVC, nil];
// 标签控制器的创建
UITabBarController *tab = [[UITabBarController alloc] init];
tab.viewControllers = arr;
// 代理
tab.delegate = self;
// 默认
tab.selectedIndex = 0;
self.window.rootViewController = tab;
[tab release];
[secondVC release];
[thirdVC release];
[fourVC release];
[fiveVC release];
[first release];
[main release];
[second release];
[third release];
[four release];
[five release];
[_window release];