Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable Return Key in empty UITextView

Tags:

ios

uitextview

In my app, I need to enable Return Key on UITextView even if UITextView is empty. By default, return key is disabled, before user not entered any symbols. How I can do this?

Thanks.

like image 539
user1774316 Avatar asked Dec 08 '22 19:12

user1774316


1 Answers

I need to enable Return Key on UITextView even if UITextView is empty.

Actually, the return key is enabled by default no matter the text view is empty or not. However, if you want to set the return key to disabled by default, you need to set the enablesReturnKeyAutomatically to YES. As the Apple Doc said:

The default value for this property is NO. If you set it to YES, the keyboard disables the return key when the text entry area contains no text. As soon as the user enters any text, the return key is automatically enabled.

like image 141
Kjuly Avatar answered Dec 11 '22 10:12

Kjuly