How to get rid of space between UITextField and Keyboard - ios

I was wondering if anyone has seen a similar problem to this where you have a random blank space between the keyboard and a UITextField? For some reason I can't find anything about this and the end of the screen is the bottom of the UITextField. Any help would be greatly appreciated.
Example Screenshot showing space between keyboard and UITextField

Start by putting the text field in a UIScrollView.
Register your view controller to respond to the notification UIKeyboardDidShowNotification. This notification will give you a dictionary that has the size of the keyboard.
Once you have the size value, you will have to do some math to figure out what you want the scroll view's contentInset to be such that the text field is just above it.
Here's an example for getting the size of the keyboard: How to get UIKeyboard size with Apple iPhone SDK

Related

IOS Keyboard with attached entry field

We use the IOS UIKeyboard to enter text into a UITextField which is positioned over our OpenGL View.
Is there a simple way to attach an entry field to the top of the keyboard, so it is within the frame of the keyboard and scrolls on and off smoothly with it, rather than moving your own UITextField when the keyboard scrolls on ? Maybe some property of the text field itself ?
Thanks
Shaun
You could put the whole view inside a UIScrollView
I think inputAccessoryView may be what you are looking for. It´s a property of UITextField.
See Documentation.

Get Keyboard size without showing it

I can get the keyboard's dimension after its displayed from the notification, BUT I would like to position my textFields so that I don't have to scroll them when the keyboard appears. To achieve this I should know the keyboard's dimension BEFORE it's even displayed.
Is this possible on iOS?
You can use a class where this all things are handled by default. Just you have to use scroll view for this.
TPKeyboardAvoidingScrollView
See if it's useful and fulfill your requirement.

Cursor disappears under keyboard in UITextView

When entering text into a UITextView, if you type enough lines or hit return enough times, the cursor will naturally go under the keyboard. Certain apps, such as the Apple Notes app, handle this just fine, scrolling the textview until the cursor is visible again. I have struggled to replicate this behavior. I've had no luck with textView.scrollRangeToVisible() with the selectedRange or textView.scrollRectToVisible() with the caret rect.
Some other things I've tried:
http://inessential.com/2014/01/07/uitextview_scroll-to-typing_bug
https://gist.github.com/DanielTomlinson/802b54f04dc0c4afe56a
I would try the following steps:
Make the UITextView's fill the entire height of the screen
Get the Keyboard Height Dynamically(See: Get the frame of the keyboard dynamically) This is especially important with the release of third party keyboards in iOS 8.
Then when the cursor goes below the keyboard, move the UITextView up by the screen height minus the keyboard height.

Resizing UITextView with UIView below

I can't understand how create something like this:
The idea is the UITextView is resizing. But how to resize it when user enter 100 rows? I need to check /n and then increment frame by lineHeight and frame of cell?
Suggest pls.
No need. The text view should be resized to fit the keyboard. After that it scrolls the text if there is more text than fits into the visible part.
The path of least resistance to getting what you're describing to work is to create a method that updates the frames of the UITextView and UIView when the keyboard goes up or down. You know when the keyboard goes up and down based on UIKeyboardWillShowNotification and UIKeyboardWillDisappearNotification. The notification contains a userInfo dictionary that specifies the y-coordinate of the keyboard with respect to your view controller's window. All you need to do is recalculate your frames subtracting the height of the keyboard (either something like 216 or 0). If you still have questions about this let me know, and I'd be happy to explain further.

UITextField does automatically change its width

This is my first question here which I could not answer myself with searching on that site.
I have a UITextField layout to the left and right of my iPhone app.
When I enter some text into it and the text is more than it can be displayed on that view it does automatically changes it width of that UITextField after textFieldShouldReturn is called.
Does anyone knows why this happens?

Resources