Reputation: 537
Anyone has a Solution for my Problem? I have an UITextField and want to Dismiss the Keyboard after pressing on Return. I added the UITextFieldDelegate and want to set the Delegate on my TextField, but the error remains...
Upvotes: 1
Views: 109
Reputation: 1360
Extend UITextViewDelegate
instead of UITextFieldDelegate
as your variable chatTextField
is of type UITextView
.
Upvotes: 3
Reputation: 344
Which one you want to use. TextField or TextView ?
because you create the "IBOutlet" of "TextView" but set the delegate to "TextField".
if you want to use "TextField" then remove "TextView" from storyboard and use "TextField" instead of it and create it's "IBOutlet".
and if you want to use "TextView" then use the "UITextViewDelegate" instead of "UITextFieldDelagate".
Upvotes: 4
Reputation: 9346
Your chatTextField
is UITextView
and you are setting it UITextField's
delegate. ADD UITextViewDelegate
after class declaration.
Upvotes: 2