mortenstarck
mortenstarck

Reputation: 2803

Hide Keyboard then push done in UITextView

I'm trying to make so that the keyboard hides then i push done on a UITextView. I no have to do it on an UITextField. But because i need multiline text i need an UITextView. I have done it for UITextField this way this.txtDefault.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return true; }; But it seemed that the UITextView doesn't have an ShouldReturn method. Have can i do it. Best Regard Morten Starck

Upvotes: 1

Views: 1163

Answers (1)

jonathanpeppers
jonathanpeppers

Reputation: 26495

Can you use a UITextField for your purposes instead?

Apple's docs on UITextView say there isn't a selector for ShouldReturn at all, hence MonoTouch isn't going to be able to make it work either.

Here is another SO question on the subject, but these guys are using Obj-C. They suggest using ShouldChangeTextInRange, but that would be ugly. Using UITextField would be easier if you can make it work for your case.

Upvotes: 1

Related Questions