search

Home  >  Q&A  >  body text

ios - textField发送消息,不收回键盘?

textField 连线方法 选择 did end on exit

正常情况下是,成功发送消息,收回键盘。

这个时候,如果不想收起键盘,然后光标还是在textField上。

该怎么实现?

在textField 连线方法里 添加 becomeFirstResponder 方法 。还是没能实现。

需求:用户聊天时,发送消息之后,键盘不收起,光标还在当前textField上。

阿神阿神2889 days ago490

reply all(5)I'll reply

  • 怪我咯

    怪我咯2017-04-17 17:45:26

    Process the sending related logic in the proxy method textFieldShouldReturn, do not call resignfirstresponder. Do not connect the did end on exit event.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 17:45:26

    Why choose to use did end on exit event? Using this event means that the keyboard will be retracted by default. Just use Touch Up Inside to write the event, and then textField becomeFirstResponder will put the cursor on it.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:45:26

    To recover the keyboard, you call resignfirstresponder. If you don’t call it, the keyboard will not be recovered

    reply
    0
  • 迷茫

    迷茫2017-04-17 17:45:26

    First remove all connection methods, add textFieldShouldReturn, and return false

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:45:26

    After sending the message, resignFirstResponder

    reply
    0
  • Cancelreply