PiterPan
PiterPan

Reputation: 1802

Choosing image from Assets it is not showing in Tab Bar Controller in SWIFT

I have a ViewController which is embed in Tab Bar Controller. I wanted to add custom icon to Tab Bar (in Main.storyboard), which is already exist in my Assets. When I do that, I don't see the icon but grey square. After when I run the app, I still have a grey square, not my own custom icon in .jpg. Describing picture bellow.

Grey square in launched application

Grey square in Xcode

Can somebody help me, how to show my own icon?

Upvotes: 0

Views: 1308

Answers (2)

Joe Benton
Joe Benton

Reputation: 3753

You could try a .png file possibly with some transparency in the image and make sure you have your image.png, [email protected] and [email protected] sizes in your Assets for retina etc.

If this doesn't work try just loading the image into a uiimageview to see if it loads okay. if it doesn't then it might be an issue with the image itself so you could try re saving it again.

Upvotes: 0

Dmitry Kurilo
Dmitry Kurilo

Reputation: 404

Check the alpha channel of your images. They should have some transparency. If not, UITabBarItem will show them as a square you've provided on the screenshot.

Upvotes: 1

Related Questions