UITextField does automatically change its width - ios

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?

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.

UITextField cursor scrolling

I have a UITextField that is programmatically created. I face the problem where my last character is not shown if the text exceeds the length of the textfield.
How can I show the last character entered and shift the text to the left?
It all works perfectly fine for my other UITextFields created in storyboards. I couldn't find an answer for the question.
Also, it I need to use textField not textView because I would have to change a lot of things.
Thanks!

How to move my chat input bar up on top with keyboard in Xcode?

I create a chat program. I've created my chat sequence using TableView. Now I have a view on the bottom of the page, contains one TextField and a send button. Now if I press on the TextField, the keyboard appears. I need to:
reduce the height of the tableView so that I still can see the most recent chat message, and return it to its former height if the keyboard is hidden.
move the view up to sit on top of the keyboard, and return it to its former position if the keyboard is hidden.
do both of things above with animation.
I'm still newbie in this keyboard + animation area. I only know I will need to implement textFieldDidBeginEditing and textFieldDidEndEditing to do this. But I don't know what code I should implement inside it. This answer provided some, but not the exact answer to my problem (it only moves the floating TextField in the scrollable view of TableView to be within the visible area, not moving a view not related with TableView). Any help or even article will be appreciated. Thanks!

How to get rid of space between UITextField and Keyboard

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

UIButton and UITextField unclickable due to UIScrollView placement?

I've began iOS development recently and have created a basic layout using Interface Builder. However, I've noticed that my UIScrollView is causing my UITextField and UIButton to be unclickable (up to a certain point).
Here is a screenshot. Everything above the red line is clickable and responds to touch events, but everything below is/does not.
I decided to move my UIScrollView down a few pixels, and noticed this "red line" moved down as well. After shrinking the height of the UIScrollView from 589px to 550px, I am now able to click anywhere on the button/in the text field (since the theoretical "red line" is now just below the button). Here is that screenshot:
So, my question is, why was the UIScrollView doing this to my UITextField and UIButton? It seems as though it was overlapping the text field and button somehow, despite it appearing to be physically below them. Is there any way to avoid this "overlap" without having to sacrifice those 39 pixels I gave up to prevent the "overlap"?
Write this code in viewDidLoad function
[self.view sendSubviewToBack:scrolView];
Hope this helps you..

Resources