I have this code:

 MeuPrimeiroViewController *primeiro = [[MeuPrimeiroViewController alloc] init];
    MeuSegundoViewController *segundo = [[MeuSegundoViewController alloc]init];

    UITabBarController *tabbar = [[UITabBarController alloc] init];

    tabbar.viewControllers = [NSArray arrayWithObjects:primeiro,segundo, nil];

    primeiro.tabBarItem.title = @"Primeiro";
    primeiro.tabBarItem.image = [UIImage imageNamed:@"1.jpg"];
    segundo.tabBarItem.title = @"Segundo";
    segundo.tabBarItem.image = [UIImage imageNamed:@"3.jpg"];


    self.window.rootViewController = tabbar;

I don't know why, the images don't show?

有帮助吗?

解决方案

You need to use the tabBarItem initWithTitle:image:selectedImage method instead. See the method definition here.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top