我想实现的效果就类似于微信或者手Q的聊天窗口,输入框在最底下,然后获得焦点时,软键盘弹出,但是此时聊天窗口的最顶上的内容还在,也就是聊天的窗口变成(手机屏幕-软键盘高度)。
思路或者demo代码或者github开源代码都OK
光阴似箭催人老,日月如移越少年。
[[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.
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.