用TPKeyboardAvoiding(Scroll,Collection,Table,text)View避免键盘遮盖住了textfield,textview

诸龙野
2023-12-01
参考:http://www.cnblogs.com/china-ldw/p/3552502.html

TPKeyboardAvoiding

git:https://github.com/michaeltyson/TPKeyboardAvoiding

官方Demo:有TPKeyboardAvoidingCollectionView/TPKeyboardAvoidingScrollView/TPKeyboardAvoidingTableView/UIScrollView+TPKeyboardAvoidingAdditions类

用法:

1,将TPKeyboardAvoiding目录添加到工程中;

2,在viewController对应的XIB中,加一个UIScrollView,将scrollView类属性设置为TPKeyboardAvoiding

4,把你需要的textfield,textview加到UIScrollView上;

5,设置textfield的键盘类型

这样textfield,textview就能实现自动上滚,并且自动设置键盘的"return"键。



 类似资料: