tags:

views:

16

answers:

2

hi all, 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

A: 

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

St3fan
IB is shoeing whites patches instead of images.i have no idea why its not coming up wid images.
shishir.bobby
Are you sure your images are correct? They should be black/white on a transparent background.
St3fan
i didnt knw that i hv to giv button inside uibarbuttons in toolbar.it working f9.thanks anyways
shishir.bobby
A: 

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.

BK