Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change property UIReturnKeyType of UITextField dynamically?

we can set this property of UITextField to "Send", "Search", "Go", etc.:

@property(nonatomic) UIReturnKeyType returnKeyType

But setting it while using the UITextField doesn't change at all.

I want this behavior: When UITextField is empty, let returnKeyType be "Return", otherwise let returnKeyType be "Send".

like image 396
yehnan Avatar asked May 11 '11 02:05

yehnan


1 Answers

Normally the returnKeyType and other properties are checked when the keyboard is displayed, but are not monitored for later updates. Try calling reloadInputViews on the text field after changing the returnKeyType, that should instruct it to refresh the keyboard settings.

like image 85
Anomie Avatar answered Sep 28 '22 04:09

Anomie