views:

197

answers:

2

I've run out of places to look for why my image will not display in the tab bar controller.

Whether I use Inkscape, Pixelmator, or an antique version of Paint Shop Pro to create and then export the PNG, I get a blue, highlighted square of nothingness or a dull gray square of nothingness. All are 30 x 30, but white on black, black on white, color, no color, none of it seems to have an effect.

As near as I can tell, I'm doing it right : http://osmorphis.blogspot.com/2009/02/tab-bar-icons-part-1_4115.html

And this question didn't resolve the issue: http://stackoverflow.com/questions/1330246/adding-tabbar-controller-icon-iphone

Here's the code from applicationDidFinishLaunching:

<// diagnostic>
UIImage *image = [UIImage imageNamed:@"outToLunch.png"];
if (!image) {
    NSLog(@"AppDelegate: 404");
}
myVC.tabBarItem.image = [UIImage imageNamed: @"outToLunch.png"];>

I'm equally receptive to a good laugh or to "Oh. I didn't know that ..."

Thanks!

+1  A: 

Try another image. Does that work?

If not, try to Clean your build (SHIFT-CMD-K, your app can not be running when doing this).

Can you post the image here? (http://imageshack.us/)


EDIT: I tested the image for you in my app (in the appDelegate applicationDidFinishLaunching), and it works fine for me. Both setting it in Interface Builder and with code.

Try setting it in IB. If that works, you may have missed a few connections :)

Emil
Emil, yes, other images work. I downloaded "18-envelope" and it showed up and behaved nicely. Upload? Yes, can do:http://img638.imageshack.us/img638/5097/hatomt02.pngNo, Ye Olde clean didn't have an effect.Thank you for jumping in!
d_CFO
See updated question.
Emil
Found it. Rookie mistake. (After forty years of coding, one would think one would be done with that sort of thing, but no-o-o-o.)I was updating the tabs with images BEFORE I was executing this statement: tabBarController = [[UITabBarController alloc] init];Sheesh.Thanks for the corroboration, though; your observation "it works for me" was the nudge I needed.
d_CFO
Hahah, easy to do these mistakes :P
Emil
A: 

Do check image transparency. According to the documentation here the guidelines for the tab bar icon are:

  • Use pure white with appropriate alpha (transparency).
  • Do not include a drop shadow.
  • Use anti-aliasing.
  • If you decide to add a bevel, be sure that it is 90° (to help you do this, imagine a light source positioned at the top of the icon).
Shaji
Shaji, to follow your suggestion and to ensure that I had image transparency, I built yet another image in Pixelmator. Underlying layer, opacity = none (fully transparent). Drawing layer, opacity = 100%. I put in a few lines so that SOMETHING would show, but no shadows and no bevel. No icon either, only that blue (selected) gray (not selected) square.
d_CFO