Trying to use TPKeyboardAvoding Scroll in my App

2.1k Views Asked by At

I'm using TPKeyBoardAvoidingScrollView in my iPhone App so that the scroll view scrolls while it reaches the end of the keyboard.

By looking at the github readme, it said that I just have to drag and drop the TPKeyboardAvoidingScrollViewinto my project and assign the class of a ScrollView to it. 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?

  • View Hierarchy

enter image description here

  • Embedded in ScrollVIew

enter image description here

2

There are 2 best solutions below

10
icodebuster On BEST ANSWER

Step 1:

  • Delete your scrollview

Step 2:

  • Select all you components that you want to put inside a scrollview, then go to Editor -> Embbed In -> Scroll View. Now you will see a UIScrolView in your view hierarchy.

Step 3:

  • Now select your UIScrollView go to the Identity Inspector and change the class UIScrollView to TPKeyboardAvodingScrollView

Check the Sample

0
Trianna Brannon On

For some reason it seems like TPKeyboardAvoidingScrollView doesnt get activated until the keyboard pops up. What worked for me were the following steps

  1. Reset your simulator so that they iPhone keyboard will pop up again (it doesn't show after you use your mac keyboard)
  2. Run the app again and click on a UITextView that is within the UIScrollview you created with TPKeyboardAvoidingScrollView

Now it should scroll