I have a UIToolbar where I have dragged a UIButton. When I set the button properties to Custom, and assign an image (or background image) the graphics don't appear. However, when I give it a custom text, the text will appear. Why is it that the images don't appear?
A:
Are you sure the image is present in your bundle/project?
Are you setting the button's image for UIControlStateNormal
?
Shaggy Frog
2010-04-12 21:45:19
Yes to both. Interesting, when I use a separate image, it appears fine. I'm wondering if something is wrong with the image that I'm using?
Sheehan Alam
2010-04-12 22:07:22
Can you display that image in a `UIImageView`? Have you tried a clean build to ensure all the resources are being correctly bundled?
Shaggy Frog
2010-04-12 22:09:07
Yes, that image does load in UIImageView and even in a normal photo editor. Build cleaned.
Sheehan Alam
2010-04-12 22:15:43
Is the button's alpha set to 0? Is it set to be opaque? Is it the same with all images or just one image?
Shaggy Frog
2010-04-12 23:08:40
Could be the image? I tried it with another image and it showed up fine...
Sheehan Alam
2010-04-13 17:41:57
Initialize the `UIImage` object separately (before the call to `setImage:forState:`) and make sure it's not `nil` for some reason.
Shaggy Frog
2010-04-13 18:15:28