I have a tabbed application project I am working on in Xcode written in Swift (Xcode 6.3 and Swift 1.2
). I am having a lot of trouble with custom Tab Bar icons. I have designed an image in Photoshop (CS6), saved it as a PNG, resized it in Prepo to be 30x30
and imported it into Xcode in the asset library. I then set the tab view controllers
icon to that image. However, it doesn't show up.
I have looked at these pages but not found any help:
https://www.youtube.com/watch?v=4qqqoAWNfZA Custom tab bar icon colors http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=19333
http://www.appcoda.com/ios-programming-how-to-customize-tab-bar-background-appearance/ https://www.youtube.com/watch?v=4Tj_SeApUrs
What is the proper process to create custom tab bar icons?
Implement a view controller that can hold some other view controllers. Show one of those view controllers. Show a tab bar at the bottom of the screen over the shown view controller. Switch between the various view controllers when the user taps on a tab bar button.
iOS UITabBarController Changing Tab Bar Item Title and Icon For a custom icon, add the required images to the assets folder and set the 'System Item' from earlier to 'custom'. Now, set the icon to be shown when the tab is selected from the 'selected image' drop down and the default tab icon from the 'image' drop down.
After a bit of research I resolved the issue, so thought I'd post here in case anyone else has a similar issue. In Photoshop I did the following:
75x75 pixels
(and named [email protected]
), 50x50 pixels
(and named [email protected]
), and 25x25 pixels
(and named imageName.png
)In Xcode I did the following:
icoImageName
.icoImageName
. Note that I did not set the 'Selected Image' under the 'Tab Bar Item' (leave this blank).Done.
I hope this helps someone. Thanks to everyone for their help as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With