Set tab bar item selected image in xcode 6
This is my setup for a tab bar item:
However when clicking on the item inside the app the 1051-id-badge-selected image is not shown, instead nothing is shown:
Is something wrong with my setup? Any ideas?
- How to create and send the json data to server using swift language
- Xcode 6 GM won't compile for iOS device, but is fine in simulator - odd error message
- IBOutlet not connecting in SWIFT
- Counting unique items in array. (Swift)
- Did the way how to globally import files change in Xcode 6 / iOS 8?
- iOS Facebook SDK MessageDialog error 202
Solutions Collect From Internet About “Set tab bar item selected image in xcode 6”
To get around this issue and set selected image without writing any code, we can also use “User Defined Run Attributes”.
Select the tab bar item, then in ‘Identity Inspector’, add a new value from ‘User Defined Runtime Attributes’.
Set the ‘Key Path’ to
selectedImage, and choose ‘Type’
Image, then fill in the ‘Value’ with your image name.
If the inspector solution is not working for you (e.g. because of an Xcode bug) you can try this solution. In AppDelegate:
var tabBarController = self.window!.rootViewController as UITabBarController let tabItems = tabBarController.tabBar.items as [UITabBarItem] tabItems.selectedImage = UIImage(named: "1051-id-badge-selected.png")
Update on May 25, 2016:
On Xcode 7.3.1 the
Selected Image field under
Tab Bar Item section is working correctly. (But I don’t know from which exact version Apple fixed it for Xcode).
- Converting a C-style for loop that uses division for the step to Swift 3
- How do I pass in a void block to objc_setAssociatedObject in swift
- SecItemAdd and SecItemCopyMatching returns error code -34018 (errSecMissingEntitlement)
- UISearchBar increases navigation bar height in iOS 11
- Building Xcode Project in Terminal – Choosing another Xcode
- NSAttributedString ignores Autoshrink and numberOfLines for UILabel (iOS 6)
- Zoom on a two dimensional UICollectionView
- Can ABNewPersonViewController be used to edit existing records?
- iOS6 : How to use the conversion feature of YUV to RGB from cvPixelBufferref to CIImage
- UIView Animation Inconsistent Result
- Working out the start and end of a day. Swift
- NSURLConnection download large file (>40MB)
- Coredata – “NSObjectInaccessibleException – CoreData could not fulfill a fault”
- Setting backgroundColor of custom NSView
- A Swift example of Custom Views for Data Input (custom in-app keyboard)