UITabBarItem Image disappearing when selected Xcode 6 Beta

uitabbar appearance ios 13
uitabbarcontroller
swift ui tab bar
uitabbar appearance swiftui
uitabbar accessibility
ios tab bar controller programmatically
detect tab bar item selected swift
uitabbarcontroller tutorial

Fairly new to development however the Xcode Betas are giving me a bit of a headache (Xcode 6 beta 5 / iOS 8).

Have found some answers but mostly relating to Xcode 5 and under.

Everything runs fine, however the selected icon/view controller disappears. In Xcode 5-4 the image assets weren't even coming through giving the following error message. Now they do, however the error message still runs.

Screenshot:

CUICatalog: Invalid asset name supplied: (null) 2014-08-12 15:16:26.521 TheApp[5275:3231837] CUICatalog: Invalid asset name supplied: (null) 2014-08-12 15:16:26.521 TheApp[5275:3231837] Could not load the "(null)" image referenced from a nib in the bundle with identifier "YourCompnay.TheApp"

I'm racking my brain trying to figure out if it's my connections / images or just an Xcode beta bug.

Def need help and a clear explanation. ELI5.

Any help would be appreciated. I can't seem to find anything specifically relating to this error.

I am in almost the exact same spot as you. Like you, my "unselected" tab images would show up fine, but for my selected tab images, they would not be present, and I'd get the "could not load null image..." error.

I had been assigning the images within the Storyboard IB... perhaps this is what you were doing too. Either way, within IB in the Attributes Inspector for the UITabBarItem, there are two different fields. One is under the Tab Bar Item section and it is named Selected Image. The other is under the Bar Item section and it is named Image. Just to be clear (restating my first paragraph but in terms of IB), I had "valid" images that I had saved within my .xcassets assigned to each of these Image/Selected_Image fields (each image was slightly different from the other to distinguish selection). The one that I had in my Image field would show up, and the one that I had in my Selected Image field would not.

If I put the "good" one from the Image field into the Selected Image field, I would still get the error, which didn't make sense to me.

HOWEVER, if I only put my "unselected" image into the Bar Item -> Image field and left the Tab Bar Item -> Selected Image empty, THEN the one image would get used in both places AND it would be highlighted blue when selected. This didn't give me the minor image change that I wanted (as my review of the Apple Docs for Bar Button Item indicated I should have "thicker lines" in my image for the selected item), it does at least give me an image for the selected tab. Hopefully this will help you as well.

UITabBarItem, A tab bar operates strictly in radio mode, where one item is selected at a By default, unselected and selected images are automatically created from the alpha � 14 UITabBarItem Image disappearing when selected Xcode 6 Beta 12 How to get the url of currently playing video in UIWebview View more network posts →

Yjo-jo's answer is not actually a solution to this problem. It makes the tab bar use the unselected image for both normal and selected states, but does not let you use a different image for the selected state, as recommended in Apple's docs.

The bug is that the 'selected image' field for tab bar items in storyboards simply does not work, and it is still a problem as of Xcode 6.0.1 - I'm using images directly included in my app's resources rather than .xcassets and I'm experiencing the same issue. The images exist in my app's bundle, they appear in the drop-down box when editing my storyboard, and yet I get the same Could not load the "(null)" image ... error, and a blank selected image.

My solution was to add this in my tab bar item's (view controller) viewWillAppear method:

[[self tabBarItem] setSelectedImage:[UIImage imageNamed:@"(selected image file)"]];

However, when doing this, I found that the size of the image changed ever so slightly when being selected/unselected, although my images were the same size. This might be because the size of the images for tab bar items is precalculated in some specific way, and we're messing around with them just as they're about to be drawn. It's a small issue but it was enough to bug me, so in order to get them perfect I removed the previous code and added this in my tab bar controller's viewWillAppear method:

[(UITabBarItem*)[[[self tabBar] items] objectAtIndex:n] setImage:[UIImage imageNamed:@"(unselected image file)"]];
[(UITabBarItem*)[[[self tabBar] items] objectAtIndex:n] setSelectedImage:[UIImage imageNamed:@"(selected image file)"]];

Where n is the index of the tab bar item. (starting from 0)

It's ugly but it works. As far as I know, the "selected image" field just blatantly does not work in Xcode 6.

rdar://19806607: UITabBar selected image for item can not be set , Summary: UITabBar's selected image set using Interface Builder can not be displayed in 6. Switch between tabs. Expected Results: According to HIG TabBar should state image disappears and log output looks like: Could not load the "(null)" image Verified in iOS 9 beta 1 and Xcode 7.0 beta (7A120f), bug still exists. ios,ios7,uitabbarcontroller,uisplitviewcontroller,uitabbaritem I have a little problem easily reproductible with Xcode 6.1.1 : Create a new Tabbed application project Set the deployment target to iOS 7 Go into the storyboard and drag and drop a UISplitViewController Link it to the UITabBarController Edit the new Tab Bar Item, set an image and

Defining selectedImage in User Defined Runtime Attributes like in this answer worked for me.

Swift Swift: Using Tab Bar Controllers in Swift – Make App Pie, 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25 Unzip the file and then place the small and the @2x pie bar image in the Assets.xcassets folder. In Xcode, press Command-N Create a new Cocoa Touch Class When a view controller is connected to a UITabBarController , this� if let image = item.image. solo así: if let selectedImage = item.selectedImage { item.selectedImage = selectedImage.imageWithColor(UIColor.yellowColor()).imageWithRenderingMode(.AlwaysOriginal) } esto resolvió el problema perfectamente. Y una pequeña adición, ya que Swift 1.2 y Xcode 6.3.2 necesitas . for item in self.tabBar.items as

Looks like a bug in UIKit, I've filed a radar already.

In order to make this work however, you should add icons manually from your view controller code. There are few things to do:

  1. Detect which UITabBarItem belongs to your view controller

YourViewController.m:

-(UITabBarItem *)tabBarItem {
  return self.tabBarController.tabBar.items[[self.tabBarController.viewControllers indexOfObject:self.navigationController]];
}

Note self.navigationController, you should just self if there is no navigation view controller wrapping your regular view controller.

  1. Change icons

YourViewController.m -awakeFromNib: function:

[self.tabBarItem setImage:[UIImage imageNamed:@"RegularImage"]];
[self.tabBarItem setSelectedImage:[UIImage imageNamed:@"SelectedImage"]];

Works for me, should work for you too. It's a bit of a hack, but as elegant as it can be.

UITabBarItem icon not colored correctly for iOS 13 when a bar tint , All items icons in the tab bar have the selected color if I set the "Bar Tint" property in Interface Builder to anything but clear. When it is set to clear, the icons are� Custom Icons (iOS 12 and Earlier) In iOS 13 or later, prefer using SF Symbols to represent tasks and modes in your app. If your app is running in iOS 12 or earlier, or if you need to create custom bitmap icons, follow the guidance below.

I have been seeing this issue across several versions of XCode. Now on 6.3 beta 3, I finally fixed it.

In my case, I solved this by doing two things:

  1. For each tab bar item, in Interface Builder, remove the "Selected Image" field (this may have been unnecessary).

  1. Right-click on your storyboard and select "Open As -> Source Code".. search for "tabBarItem". Review each item. They should look something like this:

In my case, there were duplicate/orphaned tabBarItem elements that appeared out of place and with bad/old settings. Comment out any elements that do not match your settings in IB. Clean & rebuild your app and see if you're fixed like I was.

How To Customize Tab Bar Background and Appearance, We'll also modify the images of UITabBarItem as well. First, create a new Xcode project using the “Tabbed Application” Template. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22 When user selects a tab item, the selected tab item will be highlighted with the “FinishedSelectedImage”, while� For information on the compatibility requirements for Xcode 11, see Xcode 11 Beta 5 Release Notes. Developers using iOS 13 beta 6 must also update to Xcode 11 beta 5. Warning. If your watch is running watchOS 6 beta, you must update it to watchOS 6 beta 2 or later before updating to iOS 13 beta 6, otherwise your watch will no longer be able to

Gosh Darn SwiftUI, At the current stage, SwiftUI is still missing many features, and I think even you start Xcode 11 for SwiftUI and Xcode 12 beta for iOS 14 features (Download beta software from Apple); iOS 13 / macOS 10.15 / tvOS 13 / watchOS 6; macOS Label is a convenient view that presents an image and text alongside each other.

Xcode6中使用原始TabBar不顯示selectedImage的處理方法, 原來Xcode6 后的設置方式變化了,selectedImage的渲染方式改變了。 .com/ questions/18894985/uitabbar-not-showing-selected-item-images-in-ios-7 When the user selects a tab bar item the image disappears. Xcode6(Xcode6 中使用SizeClass布局) xcode6 beta 中智能提示(自動完成)功能有時不�

UITabbarController display issues when tabbar is visible � Issue #94 , jessesquires added this to the v5.0 beta release milestone on Feb 23, 2014 when you select a chat, the chat view pushes over and the tabbar is hidden. i [ 6.0-beta5] Input Toolbar not visible when presented within UITabBarController # 573 I have it working in iOS 10 / Xcode 8.1 / Swift 3, but when the keyboard comes�

Comments
  • How do organize images in your project? Do you use .xassets or simply add them to the bundle as resources?
  • I have them currently in .xassets.
  • This totally worked. I can't believe it was something so simple. Thank you!
  • Seems like a bug in the XCode 6 beta.
  • This is a workaround but not a real solution. I'm not using .xcassets for my tab bar items, just image file names, and the same problem exists: the selected tab bar icon, which is a valid image, just appears blank when selected. This is still a problem as of Xcode 6.0.1.
  • Saved my life, just left unassigned the selected message, and it uses the unselected image applying the selected tint color. Neat!
  • But this doesn't solve the problem of showing correct highlighted/selected image in TabBar.
  • It indeed does work, make sure the image name match the name in asset catalog. It's a work around for using IB to config UI