0

I have an UITextview, when user taps on UITextview i need to hide the default keyboard. For that i have done,

 [myTextView setEditable: NO];

So the keyboard is not shown, here i have created an Custom View with UIButton, i need to show this UIView when the user taps on UITextView, for that i have done,

textViewDidBeginEditing{

//Here i have added UIView as subview 

}

But this method is not working because of,

[myTextView setEditable: NO];

and i need to close the UIView when user clicks the close button inside the UIView

2 Answers 2

3

You should be using resignFirstResponder instead of setting the UITextView to not editable. This will hide the system keyboard.

 [myTextView resignFirstResponder];

If you want to use a different view for the keyboard then the system provided one then set inputView on the UITextView to the custom view you want to be used in place of the system keyboard.

myTextView.inputView = myCustomView;
Sign up to request clarification or add additional context in comments.

7 Comments

what is the possible way to show my customview when user taps on UItTextVeiw..?
@HarishSaran Just set inputView on the UITextView to point to your custom view before the user taps on the UITextView perhaps in a viewDidLoad method on the controller
@Powers: I have a close button in my custom view how can i close the view when user taps the button, is removefromsuperview is the mothod to do that?
@HarishSaran If you are looking to close the keyboard with your custom view then you want to use resignFirstRepsonder on the UITextView to do that.
@Powers : Instead of default keyboard, i'm using the customview, which consists of one Button, when user taps on that button i want to close the mycustomview, Do resignFirstRepsonder do that?
|
1

Perhaps using textFieldShouldBeginEditing instead of setEditable: NO works?

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
   //Here i have added UIView as subview 
   return NO;
}

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.