码迷,mamicode.com
首页 > 其他好文 > 详细

《找地儿》

时间:2015-12-08 08:44:03      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

技术分享技术分享

- (void)viewDidLoad {

    [super viewDidLoad];

 

    tabBar = [[UITabBarController alloc]init];

    tabBar.tabBar.backgroundImage = [UIImage imageNamed:@"标题栏背景.png"];

    [tabBar.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"标题栏选中.png"]];

    [tabBar.tabBar setTintColor:[UIColor yellowColor]];

     

    OneViewController *ontVie = [[OneViewController alloc]initWithNibName:@"OneViewController" bundle:nil];

    twoViewController *twoV=[[twoViewController alloc]initWithNibName:@"twoViewController" bundle:nil];

    threeViewController *threeV = [[threeViewController alloc]initWithNibName:@"threeViewController" bundle:nil];

    fourViewController *fourV = [[fourViewController alloc]initWithNibName:@"fourViewController" bundle:nil];

 

    ontVie.tabBarItem.image = [UIImage imageNamed:@"1.png"];

    twoV.tabBarItem.image = [UIImage imageNamed:@"2.png"];

    threeV.tabBarItem.image = [UIImage imageNamed:@"3.png"];

    fourV.tabBarItem.image = [UIImage imageNamed:@"4.png"];

    

    ontVie.tabBarItem.title = @"我的收藏";

    twoV.tabBarItem.title  = @"自选位置";

    threeV.tabBarItem.title = @"当前位置";

    fourV.tabBarItem.title = @"更多";

    

    tabBar.viewControllers = @[ontVie,twoV,threeV,fourV];

}

- (IBAction)ButtonOne:(id)sender {

    tabBar.selectedIndex = 0;

    [self presentViewController:tabBar animated:YES completion:nil];

}

 

- (IBAction)buttonTwo:(id)sender {

    tabBar.selectedIndex = 1;

    [self presentViewController:tabBar animated:YES completion:nil];

}

- (IBAction)buttonThree:(id)sender {

    tabBar.selectedIndex = 2;

    [self presentViewController:tabBar animated:YES completion:nil];

}

- (IBAction)setBTN:(id)sender {

    tabBar.selectedIndex =3;

    [self presentViewController:tabBar animated:YES completion:nil];

}

《找地儿》

标签:

原文地址:http://www.cnblogs.com/liuyingjie/p/5028054.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!