I try to show a png
image on my navigation panel. I do as following:
UIImage *img = [UIImage imageNamed:@"1.png"];
UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithImage:img style:UIBarButtonItemStylePlain target:self action:@selector(myAction)];
self.navigationItem.rightBarButtonItems = @[myButton];
The img
isn't nil
, however myButton
is shows as a white square. The size of this square is the same as the size of my image
, but the image isn't shown, just a white square. I have a @2x
version of my image for retina and I selected my project as a target for both these images.
What can be wrong?