Programmatically Setting UITabBar Titles

前端 未结 2 761
盖世英雄少女心
盖世英雄少女心 2021-01-16 06:41

i had programetically add the tabbar as shown below:-

FirstViewController *obj_FirstViewController = [[FirstViewController alloc] initWithNibName:@\"FirstVie         


        
2条回答
  •  终归单人心
    2021-01-16 06:57

    Try this way...

    NSMutableArray *controllers = [[NSMutableArray alloc] init];
    FirstViewController *obj_FirstViewController = [[FirstViewController alloc] init];
                    [obj_FirstViewController setTitle:@"first"];
                    UITabBarItem *item = [[[UITabBarItem alloc] setTabBarItem:          [[[UITabBarItem alloc] initWithTitle: @"First") image:[UIImage imageNamed:@"first.png"] tag:2] autorelease]];
                    [obj_FirstViewController setTabBarItem:item];
                    [controllers addObject:obj_FirstViewController];
                    [obj_FirstViewController release];
    

提交回复
热议问题