문제

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