Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top