2016-09-04 11 views
0

4 개의 뷰 컨트롤러가있는 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

다만 UR 이미지 크기가 적절한 또는 ..u에만 유효 크기의 이미지도 임의의 크기

줘야하지 확인
2

TabBar의 크기는이

1X @ 크기 25 × 25 (최대 같아야 : 32 X 48) 배 크기 @

50 × 50 (최대 : 96 X 64)

3X @ 크기 75 X 75 (최대 144 X 96)

+0

예, 있습니다. 고맙습니다.. –

관련 문제