views:

50

answers:

1

I have a navigation controller and I want to set an image to the bottom tool bar and and I want to add buttons to it how would I do this?

A: 

Its usually best to read the Documentation a bit as it usually tells you things you to do.

For UIToolbar documentation here

Upon reading this you can see there is a setItems which takes an NSArray of UIBarButtonItems.

Your best bet is probably something along these lines. Assuming you want to be able to Use Images for the buttons. If not, let me know and I can update the answer.

UIToolbar *toolbar = [[UIToolbar alloc] init]; NSMutableArray *arrayOfButtons = [NSMutableArray new];

UIImage *image = [UIImage imageNamed:@"image.png"]; UIBarButtonItem *button1 = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStyleBlack target:self action:@selector(doSomething)];

[array addObject:button1];

[toolbar setItems:arrayOfButtons];

Kyle Browning
yes for buttons i want to add image and for the tool bar aswell..i mean i want to see my image as a tool bar upon that these buttons will be there
lak in iphone