STANLEY
STANLEY

Reputation: 181

How to change tab bar item' s icon?

I made a tab bar controller app in Xcode for the iPhone 4, but I am having difficult to change the icon of tab bar items.

Here is my current code:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
        if (self) {
            self.title = NSLocalizedString(@"abc", @"abc");
            self.tabBarItem.image = [UIImage imageNamed:@"abc.png"];
        }
        return self;
    }

I'm sure that abc.png is under the group "images", and its size is 25*25px, and the file size is 4KB.

if I change the picture to another one, it shows well.

It seems this is picture problem. However, they are same size, made by Photoshop, saved as a png.

How do I fix it?

Upvotes: 1

Views: 817

Answers (2)

STANLEY
STANLEY

Reputation: 181

it is problem of that picture.I dont know what reason it is. I make another one, works now.

Upvotes: 0

NULL
NULL

Reputation: 1858

If your image showed as a white box then just make the image's background transparent.. that's will do the tricks....

Upvotes: 1

Related Questions