56

苹果开发中文网站iOS 键盘管理器:FJFKeyboardHelper

 5 years ago
source link: http://www.cocoachina.com/ios/20190320/26612.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
我们项目中很经常会碰到输入框和键盘的遮挡问题,写多了我们会发现,不同视图和场景下的处理逻辑大同小异,都是先注册监听键盘的弹起和隐藏事件,然后在弹起和隐藏的时候做处理,之后再移除键盘的相关监听,因此你会发现,重复性代码挺多;虽然现在已经有了IQKeyboardManager这样优秀的第三方来管理,但有时候又会觉得IQKeyboardManager过于重量级,功能过于庞大,你可能不想引入这么庞大的第三方,出于这个原因我自己写了一个键盘管理的辅助类,来处理键盘和输入框的遮挡事件,核心代码就一百多行,处理只需要一

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK