显示 iPhone 键盘时调整 UIView 大小,如何操作?
我将向您展示一个众所周知的 Whatsapp 的例子 当您触摸文本内部时,键盘会弹出,因此我必须向上移动或移动所有栏并将视图大小调整为一半,这样我仍然可以看到我正在输入的文本和发送按钮
第一阶段: http://www.appbank.net/wp-content /uploads/2010/10/WhatsAppMessenger-18.jpg
第 2 阶段: http://www.onetooneglobal.com/wp-content/uploads /2011/02/onetoone_whatsapp_2.png
实现这一目标的最佳方法是什么?
I will show you an example with the well known whatsapp
When you touch inside the text the keyboard pops up , so I have to move or shift all that bar up and resize the view to half, so I can still see the text that I'm typing and the send button
Phase 1:
http://www.appbank.net/wp-content/uploads/2010/10/WhatsAppMessenger-18.jpg
Phase 2:
http://www.onetooneglobal.com/wp-content/uploads/2011/02/onetoone_whatsapp_2.png
What would be the best way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个方法。根据您的要求进行编辑。
Try this methods. Edit it according to your requirement.
您需要听UIKeyboardDidShowNotification 和 UIKeyboardDidHideNotification,并在与您提供的选择器相对应的方法中通知中心随意调整视图大小(通常通过更改 UIView.frame 属性)
You'll want to listen to the UIKeyboardDidShowNotification and UIKeyboardDidHideNotification, and in the method that corresponds to the selector you've provided the notification center resize your views at will (typically by changing the UIView.frame property)