I have one textfield and textview in the view. I want to show toolbar on keyboard when my editing text in textView but I don't want to show toolbar while editing textField. I'm using below code:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
[super viewWillAppear:animated];
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(keyboardWillShow:)
name: UIKeyboardWillShowNotification object:nil];
[nc addObserver:self selector:@selector(keyboardWillHide:)
name: UIKeyboardWillHideNotification object:nil];
return YES;
}
and
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification
object:nil];
return YES;
}
My problem is when user trying to edit textfield and directly start editing textView we are not able to show toolBar for it then? How can I show toolbar on keyboard for such situation?