Я использую 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
Спасибо за это предложение. Это сработало. –