Tap on UITextField's clear button hides keyboard instead of clearing text

前端 未结 5 1464
[愿得一人]
[愿得一人] 2021-02-07 03:54

In iPhone, I have a view which has a UITextField. When I tap on the clear button of UITextField\'s the keyboard dismissed instead of clearing the text

5条回答
  •  执笔经年
    2021-02-07 04:46

    Just make sure U've given these two

    editingTextField.delegate = self;
    editingTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
    

    TextFieldShouldClear is needed only if you need to do some customizations :-)

    Are you doing some thing in this method?

    Maybe you are are calling resignFirstResponder in this delegate method, thats why the keyboard is getting dismissed.

    Please go through the delegate methods, and check what u r doing exactly.

提交回复
热议问题