TPKeyboardAvoidingScrollView 实现自动上滚,避免键盘遮盖住了textfield,textview等控件

TPKeyboardAvoiding

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

用法:

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

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

3,在代码中让UIScrollView调用 [self.scrollViewcontentSizeToFit];

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

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

原文地址:https://www.cnblogs.com/china-ldw/p/3552502.html