Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top