Lücks
Lücks

Reputation: 3984

iOS: Toolbar above keyboard

I have a UIToolBar, and a TextBox. When I select the TextBox, the keyboard appears and the toolbar disappears (because the keyboard is in front of the toolbar). I want to do like status update of facebook, when you select the TextBox, the Toolbar is above the keyboard:

Status Facebook

How can I do this?

Upvotes: 0

Views: 6456

Answers (3)

Doug
Doug

Reputation: 1853

Here is a simple and objective tutorial.

http://www.edumobile.org/iphone/how-to-make-an-app-2/toolbar-animation-along-with-the-keyboard/

Upvotes: 0

Tomskiis
Tomskiis

Reputation: 134

First create a UIToolbar that has your desired buttons etc...

Then all you need to do is on

 - (void)textViewDidBeginEditing:(UITextView *)textView
{
    toolBar *tb = [[myToolbar alloc] init]
    [textView setInputAccessoryView:tb];
}

if Not try this using IB Maybe (not tested)

myToolbarClass* myToolbar = [[[NSBundle mainBundle] 
loadNibNamed:@"toolbarNib" owner:self options:nil] objectAtIndex:0]
[textView setInputAccessoryView:myToolbar];

Upvotes: 1

Dmitry Shevchenko
Dmitry Shevchenko

Reputation: 32394

Text fields have this property called inputAccessoryView, that allows you to put any view on top of the keyboard. It looks like your case is pretty simple, otherwise, if you cannot use accessory view, you can look at dozens of implementations here.

Upvotes: 7

Related Questions