UIKeyboardViewController使用注意
方法一:
UIKeyboardViewController可以很方便的隐藏键盘
步骤:
1,在.h import "UIKeyboardViewController.h" ,继承协议:UIKeyboardViewControllerDelegate
2,定义全局变量 UIKeyboardViewController *keyBoardController;(这里一定要是全局变量)
3,在viewDidLoad: 添加
keyBoardController = [[UIKeyboardViewController alloc] initWithControllerDelegate:self];
[keyBoardController addToolbarToKeyboard];
特别注意第二步
方法二:
另外有一个更简单的第三方:TPKeyboardAvoiding
只需要把textField,textView相关控件放在UIScrollview中,UIScrollview是继承TPKeyboardAvoidingScrollview,就可以了。
注意:继承TPKeyboardAvoidingScrollview的时候要小心,因为默认TPKeyboardAvoidingCollectionView在前面