UISegmentedControl UITabBarController

//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];
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值