0

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

icodebuster
  • 8,890
  • 7
  • 62
  • 65
user2200321
  • 325
  • 1
  • 4
  • 18
  • your scroll view is empty. – nielsbot Jun 07 '13 at 02:18
  • How do I add the UITextView to it through Storyboard? I know I can create it programatically, but I have too much stuff linked up to it to make major changes. If I have to then I will, but is there something I can do in Storyboard? Thanks! – user2200321 Jun 07 '13 at 02:27
  • @user2200321 did you find solution to this problem? – ViruMax Apr 24 '14 at 10:25
  • @ViruMax, sorry man I actually don't remember what I did with this, it was a while back. I'm pretty sure the accepted answer worked for me. – user2200321 Apr 25 '14 at 04:43

2 Answers2

4

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

icodebuster
  • 8,890
  • 7
  • 62
  • 65
  • Thanks! But this had no effect either! See my latest edit for screenshot. – user2200321 Jun 07 '13 at 04:25
  • Did you change the class of the `UISCrollView` to `TPKeyboardAvoidingScrollView` – icodebuster Jun 07 '13 at 04:32
  • @user2200321 please check the sample with storyboard. – icodebuster Jun 07 '13 at 04:35
  • 1
    thanks much for the sample, it works great. However, I'm following an identical setup and the scrollview still refuses to move. Could the fact that the controller is embedded in a Navigation Controller have anything to do with the problem? – user2200321 Jun 07 '13 at 04:39
  • @user2200321 No I dont think so. Is your scroll view at the top position or below when the keyboard appears – icodebuster Jun 07 '13 at 04:43
  • It actually takes up the whole page, and the keyboard just pops up over it. – user2200321 Jun 07 '13 at 04:47
  • @user2200321 can't understand what is causing your issue. I have worked with TPKeyboardAvoiding but never faced this issue. Just create a sample and see if its working in the sample – icodebuster Jun 07 '13 at 04:56
  • 2
    I am also facing the same issue. I have made textfields and embedded them in a scroll view and set the class of the Scroll View to be TPKeyboardAvoidingScrollView. However, the view does not scroll up when the keyboard is hiding the bottom of the textfield. I am using storyboarding for this and it is not working. – Siddharth Dec 21 '13 at 13:49
  • @Siddharth did you checkout the sample project? – icodebuster Dec 22 '13 at 05:55
  • 1
    Scroll view is `TPKeyboardAvoidingScrollView` for 'first name' field view is scrolled up, but for others (last name, email, password) view is not scrolled up. :/ any ideas? Tried to redo layout, tried setting bigger height of the view – ViliusK Nov 14 '15 at 13:27
0

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

Trianna Brannon
  • 1,246
  • 11
  • 12