iMessage Style Receding Keyboard in an iOS App

后端 未结 3 678
无人共我
无人共我 2020-11-28 18:09

I\'ve been wondering if it is possible to replicate the behavior of Apple\'s iOS5 keyboard in the messages app, without using any private API calls. When you scroll down pas

3条回答
  •  粉色の甜心
    2020-11-28 19:05

    Vladimir's simple solution will hide the keyboard as the user scrolls down. However to finish the question regarding iMessage, in order to keep a TextField always visible and anchored to the top of the keyboard, you need to implement these methods:

    - (UIView *) inputAccessoryView {
         // Return your textfield, buttons, etc
    }
    
    - (BOOL) canBecomeFirstResponder {
        return YES;
    }
    

    Here's a good tutorial breaking it down more

提交回复
热议问题