IOS如何实现软键盘出现的时候,窗口的高度减少?(类似于聊天的窗口)
大家讲道理
大家讲道理 2017-04-18 09:22:30
0
3
586

我想实现的效果就类似于微信或者手Q的聊天窗口,输入框在最底下,然后获得焦点时,软键盘弹出,但是此时聊天窗口的最顶上的内容还在,也就是聊天的窗口变成(手机屏幕-软键盘高度)。

思路或者demo代码或者github开源代码都OK

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
左手右手慢动作
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillAppear:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDisappear:) name:UIKeyboardWillHideNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
    

Then just set the frame of the UI

迷茫

Are you talking about NavagationBar?
If you are talking about this, then your problem will be solved. Just add a NavagationController to the first view as the rootController. This is very simple, but you still need to learn it

伊谢尔伦

Use notifications to monitor keyboard events, and then change the frame of the view. This is the idea of ​​​​2.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template