0
votes

i have 5 UIbarButton items in a toolbar, how can i set images on each barbutton, i tried through IB, but it not coming up, how can i do it ptogrammatically? one of bar button looks like this

aBar = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"a.png"]style:UIBarButtonItemStylePlain target:self action:@selector(aMethod)];

i already conencted all barbuttons ion IB.

regards

2

2 Answers

0
votes

Should work with IB. Be sure that your button type is set to Custom maybe?

0
votes

jus check if the a.png is added to your project.

Or first take create a UIImage *img = [UIImage imageNamed:@"a.png"];

also check if IBoutlets are correctly connected.

But mostly the problem is because the image returned is nil.