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

前端 未结 5 1528
[愿得一人]
[愿得一人] 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:35

    Try this code after you attach delegate of uitextifield

    -(BOOL)textFieldShouldClear:(UITextField *)textField
    {
         return true;
    }
    

提交回复
热议问题