在viewDidLoad里写tabbar

来源:互联网 发布:软件 地图 编辑:程序博客网 时间:2024/06/08 03:52
 UITabBarController* tabbar = [[UITabBarController alloc] init];     tabbar.delegate = self;        FirstViewController* first = [[FirstViewController alloc] init];    SecondViewController* second = [[SecondViewController alloc] init];         NSArray* array = [NSArray arrayWithObjects:first,second, nil];    tabbar.viewControllers = array;    [first.tabBarItem initWithTitle:@"first" image:[UIImage imageNamed:@"alarm_30.png"] tag:1];    [second.tabBarItem initWithTitle:@"second" image:[UIImage imageNamed:@"alien_30.png"] tag:2];    first.tabBarItem.badgeValue = @"1";    [self.view addSubview:tabbar.view];


 

原创粉丝点击