[英]Trying to use TPKeyboardAvoding Scroll in my App
I'm using TPKeyBoardAvoidingScrollView
in my iPhone App so that the scroll view scrolls while it reaches the end of the keyboard. 我在iPhone应用程序中使用
TPKeyBoardAvoidingScrollView
,以便滚动视图在到达键盘末端时滚动。
By looking at the github readme, it said that I just have to drag and drop the TPKeyboardAvoidingScrollView
into my project and assign the class of a ScrollView to it. 通过查看github自述文件,它说我只需要将
TPKeyboardAvoidingScrollView
到我的项目中并为其分配ScrollView的类。 I tried it, but it doesn't behave the way it is supposed to (nothing different happens). 我尝试过,但是它并没有按照预期的方式运行(没有发生任何不同的事情)。
This is my view hierarchy, is there anything wrong with it? 这是我的视图层次结构,这有什么问题吗?
Step 1: 第1步:
Step 2: 第2步:
Editor -> Embbed In -> Scroll View
. Editor -> Embbed In -> Scroll View
所有组件,然后转到Editor -> Embbed In -> Scroll View
。 Now you will see a UIScrolView
in your view hierarchy. UIScrolView
。 Step 3: 第三步:
UIScrollView
go to the Identity Inspector
and change the class UIScrollView
to TPKeyboardAvodingScrollView
UIScrollView
转到Identity Inspector
并将UIScrollView
类更改为TPKeyboardAvodingScrollView
For some reason it seems like TPKeyboardAvoidingScrollView doesnt get activated until the keyboard pops up. 由于某种原因,直到键盘弹出后,TPKeyboardAvoidingScrollView才被激活。 What worked for me were the following steps
对我有用的是以下步骤
Now it should scroll 现在它应该滚动
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.