问题
Hi there I have a UIView with a bunch of UITextfields. My problem is that my UITextfields are present from the top to the bottom of my screen. So when the keyboard pops up, it covers half the screen and consequently the UITextfields below...What can I do so that all the fields can be edited by simmply scrolling when the keyboard is visible?
回答1:
You need to embed your UIView into a UIScrollView and then change the size of the UIScrollView when the keyboard pops up.
回答2:
Just give the view a new transform that moves it up. Eg.
[myView setTransform:CGAffineTransformMakeTranslation(0, -keyboardSize.height)];
Thats also animatable, just give it the same animation values as the keyboards and it will look perfect.
回答3:
This solution is from XCode 5, iOS 7.0 and Storyboards. It worked for me quite well.
http://www.youtube.com/watch?v=4oCWxHLBQ-A
来源:https://stackoverflow.com/questions/5608761/how-to-make-a-uiview-scrollable