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?
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 .
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];
Here is a simple and objective tutorial.
http://www.edumobile.org/iphone/how-to-make-an-app-2/toolbar-animation-along-with-the-keyboard/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.