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;
이미지에 알파 마스크가 있습니까? 그렇지 않다면 이미지의 렌더링 모드를 항상 원래대로 설정해야합니다 : 'UIImage * image = [[UIImage imageName : @ "timer_post_tab.png"] imageWithRenderingMode : UIImageRenderingModeAlwaysOriginal]; ' – beyowulf
이 제안에 감사드립니다. 그것은 효과가 있었다. –