Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add a UIToolbar to a UIViewController?

I have a UIViewController. I want to add a UIToolbar to the bottom, but IB is not letting me. How can I achieve this?

Note: The UIViewController is part of a UINavigationController. I'm not sure if this affects the visibility of the toolbar.

like image 319
Sheehan Alam Avatar asked Jan 19 '26 20:01

Sheehan Alam


1 Answers

Starting from iOS 3.0 you can set toolbar items you want using following UIViewController's method:

- (void)setToolbarItems:(NSArray *)toolbarItems animated:(BOOL)animated

of simply set or override toolbarItems property.

And toolbar will appear automatically if you put your view controller inside navigation controller.

like image 98
Andriy Avatar answered Jan 21 '26 12:01

Andriy