Problem with UIScrollView and keyboard in iPhone - iphone

Let's see: i have to views each with a couple of textfields.
One was built regularly, the other one has more textfieds and components so i added a scroll, which works (sorta). The problem is that, now, when i touch one of the text fields the keyboard appears and it hides the components, it doesn't scroll "naturaly" like in the regular view with no scroll (there, you know, the keyboard appears and the view "moves" in order to show the active text field).
So how can i accomplish that from my scroll?
I hope i've been clear, i'm an iOS newbie.

Your answer should be found here.
How to make a UITextField move up when keyboard is present?

Related

Swift: How to make view controller scroll to text field when keyboard appears

I have a view controller with 8 text fields placed vertically in the view. The problem is that the keyboard obstructs some of the text fields so that the user cannot enter any data. So, basically I need a way to scroll the view.
I did try following the approach listed in this StackOverflow question but had trouble converting some of the objective-c to Swift.
How to make the view controller scroll to text field when keyboard appears
I was wondering if anyone has solved this problem in Swift and if so could post an example?
Thanks in advance!
Hi I've resolved this problem through subclassing UIScrollView. This is a swift version of scrollView and it works with auto layout.
You can checkout here https://github.com/honghaoz/AutoKeyboardScrollView
Basically, the idea is registering keyboard notifications (e.g. UIKeyboardWillChangeFrameNotification), and scroll to let active textFields visible when keyboarding is showing.

UIView container to autoscroll on keyboard resize

I have a UIViewController, it's a view (UIView) containing two elements - UIPageControl and also a UIScrollView. Now, when using normal keyboard, the view is a perfect fit, sharing the screen with the keyboard. But when an international keyword is used, the keyboard would add an extra ribbon for showing the international characters. When that's happened, the view would be covered by the extra keyboard ribbon. The view can't be resized as the UIScrollView view contains a table of two rows of fixed size. So now I am wondering if I should find a way to allow the UIView container to up shift to accommodate the ribbon and shift back when the ribbon disappears. Or is there any other better solutions to work around the issue?
Check out my answer to this stackoverflow post here: detect the appear and disappear of international keyboard
Basically, you'll want to sign up to receive notifications about when the keyboard is shown. From there you can get the keyboard frame size and then adjust views in your window to display properly. The tutorials in the post really do a good job explaining how to do this. Check them out! If you still have questions I can try to help you with specifics.

iPhone keyboard with a UITextView

I feel that this question has been asked 10^78 times, but for some reason, am unable to find the question, nor the answer ..
I want to add a keyboard with a uitextView at the top .. Exactly like the default SMS application on the iPhone ..
How can I do that?
*Bonus: if you can also give me a hint as to how to animate it with the keyboard (goes down when the keyboard animates out .. and goes up with the keyboard);
You need to use a UIToolbar (containing your text views, etc.) and set the inputAccessoryView property of the UITextView to that toolbar. The animation should take place without any additional code.
See http://www.randomsequence.com/articles/adding-a-toolbar-with-next-previous-above-uitextfield-keyboard-iphone/

iPhone Keyboard Adjust In View

I've been searching, but haven't quite found a complete answer, and the Apple docs aren't much help.
I have an application with a UIView that has a lot of text fields on it, ranging from the top of the view to the bottom. When the user clicks the first UITextField the keyboard pops up. The keyboard has three buttons above it, previous, next, and done on a toolbar InputAccessoryView.
Basically, let's say there are 6 UITextField boxes that space from the top of the view to the bottom. When the user gets past the third text field, the keyboard blocks the bottom three. How do I have the view adjust up when putting text in the bottom three text fields?
You need to place your textfields into a UIScrollView, and either translate the view above the keyboard when it is active and away when it is down, or another solution such as always having the keyboard up on that page, which'll save you the setFrame calls on your UIView/UIScrollView depending on what the keyboard is doing.
This will further help:
How to adjust the view position when the keyboard opens in iPhone?

IPhone: How to implement scrolling behavior, similar to iPhone SMS app [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to make a UITextField move up when keyboard is present
I'm trying to implement something very similar to the "chat like" screen of the iPhone sms app. Basically, it has a ScrollView with all the message bubbles, and a TextField at the bottom, for writing a new message.
When the TextField is clicked, the keyboard appears and everything seems to scroll upwards so that the TextField is over the keyboard and not hidden by it.
Apple's docs suggest implementing a screen that should support the appearance of a keyboard, using a ScrollView that resizes when the keyboard appears (while maintaining the same contentsize). In my case, that would mean I need a ScrollView to contain the whole chat screen (messages and TextField), so everything would resize neatly on keyboard appearance. However, the messages are already inside a ScrollView, and this behavior is not supported.
The only choice I can see, is somehow implementing the refitting behavior on my own, without using the external ScrollView. But that would seem like a lot of delicate coding for the scrolling and resizing animations of both the message bubbles and the TextField to work perfectly.
What should I do?
The scrollview resizing is effectively done manually, checking the height of the keyboard and shortening the scrollview by its height.
In the case of he SMS screen, the text field isn't in the scrollview, so you simply have a scrollview sitting above a uiview that contains the posting bits. When the keyboard appears you shrink the scrollview as normal and slide the uiview up by that same keyboard-height amount.
There's nothing magical about shrinking the scrollview as Apple suggests: moving views is just as easy and sensible.