2016-09-04 54 views
0

4つのView Controllerを持つUITabBarControllerを使用しています。これらはDashboard、ComposeMessage、PostMessage、およびProfileです。私はtabBarItemで画像を使用したいと思います。問題は画像がUITabBarに表示されていないことです。UITabBarController画像が表示されない

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

    DashboardViewController *social = [[DashboardViewController alloc]init]; 
    social.tabBarItem.image = [UIImage imageNamed:@"prifile_tab.png"]; 
    [customBar addChildViewController:social]; 

    ComposeMessageViewController *composeMessage = [[ComposeMessageViewController alloc]init]; 
    composeMessage.tabBarItem.image = [UIImage imageNamed:@"timer_post_tab.png"]; 
    [customBar addChildViewController:composeMessage]; 


    PostMessageViewController *postMessage = [[PostMessageViewController alloc] init]; 
    postMessage.tabBarItem.image = [UIImage imageNamed:@"timer_post_tab.png"]; 
    [customBar addChildViewController:postMessage]; 

    ProfileViewController *profile = [[ProfileViewController alloc] init]; 
    profile.tabBarItem.image = [UIImage imageNamed:@"timer_post_tab.png"]; 
    [customBar addChildViewController:profile]; 

    NSArray *tabBarArray = @[social,composeMessage,postMessage,profile]; 
    [customBar setViewControllers:tabBarArray]; 

    self.window.rootViewController = customBar; 
+0

画像にアルファベットはありますか?そうでない場合は、イメージのレンダリングモードを常にオリジナルに設定する必要があります。 'UIImage * image = [[UIImage imageName:@" timer_post_tab.png "] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; ' – beyowulf

+0

この提案をありがとう。出来た。 –

答えて

1

だけでウル画像サイズが適切であるか..uが唯一の有効なサイズの画像もランダムなサイズ

を与えるべきではないチェック
2

TabBarのサイズは、この

1X @サイズ25×25(最大ようにする必要があります:×32 48)2Xサイズ@

50×50(最大:96×64)

3X @:サイズ75×75(最大:144×96)

+0

はい、私は持っています。ありがとうございました.. –

関連する問題