I have a view controller with a scrollview with lots of text boxes, when i click on one of the text boxes and the keyboard appears, the content size of the scrollview isn’t long enough to show everything with the keyboard open. How can i change the content size every time the keyboard pops up and set it back once it vanishes?
Also is there a method to make it vanish without resignfirstresponder on every textfield?
Hope someone can help me, I’m pretty new to Objective C.
I have a view controller with a scrollview with lots of text boxes, when
Share
contentSizeprobably isn’t the property you should be changing.Try changing the
frameproperty of the scroll view (i.e. make it n pt smaller, where n is the height of the keyboard – 216 in portrait, 162 in landscape.)The scroll view should deal with letting your content scroll correctly after you’ve changed it’s frame.
The content size property is the size of the thing that is being scrolled – this doesn’t change, it’s just the amount that you can see that has changed.
(If you’re feeling flash, you can animate the change in height of the frame 🙂