开发者

iphone Development - UITextField - Display (X) on the right [duplicate]

开发者 https://www.devze.com 2023-03-07 18:14 出处:网络
Th开发者_Python百科is question already has answers here: Closed 11 years ago. Possible Duplicate: Adding the “Clear” Button to an iPhone UITextField
Th开发者_Python百科is question already has answers here: Closed 11 years ago.

Possible Duplicate:

Adding the “Clear” Button to an iPhone UITextField

hey there, i created a UITextField and i want to add an (X) -CLEAR- button to the right of it. The regular button that clears what is already written in the textfield. Thanks.


set the clearButtonMode

field.clearButtonMode = UITextFieldViewModeAlways;
field.clearButtonMode = UITextFieldViewModeNever;
field.clearButtonMode = UITextFieldViewModeUnlessEditing;
field.clearButtonMode = UITextFieldViewModeWhileEditing;

or use Interface Builder, it has a setting for the clear button as well.


Set the text field's clearButtonMode. See here.

0

精彩评论

暂无评论...
验证码 换一张
取 消