现在的位置: 首页 > 综合 > 正文

UITabBarController

2018年05月25日 ⁄ 综合 ⁄ 共 866字 ⁄ 字号 评论关闭
tabBar = [[UITabBarController alloc] init];


    tabBar.delegate = self;


   Page1* blueViewController = [[Page1 alloc] init];


   Page2* yellowViewController = [[Page2 alloc] init];


    NSArray *viewControllerArray = [NSArray arrayWithObjects:blueViewController,yellowViewController,nil];


    tabBar.viewControllers = viewControllerArray;


    tabBar.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);


    [self.view addSubview:tabBar.view];


    [viewControllerArray release];








、、、、、、、、、、、、
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil


{


    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];


    if (self) {


        // Custom initialization


        UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"礼品" image:[UIImage imageNamed:@"礼品.png"] tag:1];


        self.tabBarItem = item;


        [item release];


    }


    return self;


}

ios 设置tabbar选中颜色

 [self.tabBarController.tabBar setSelectedImageTintColor:[UIColor greenColor]];

抱歉!评论已关闭.