Reputation: 3984
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:
How can I do this?
Upvotes: 0
Views: 6456
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
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
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