How can I keep this toolbar and text field above the keyboard? - ios

I have a UIView that contains a UITableView and a toolbar with a UITextField
When I tap the text field, the keyboard covers it over.
I want to keep the toolbar above the keyboard, just like in the native Messages app. Is it better to add this toolbar as the last cell in the TableView or animate the toolbar's Y position to move up and down when it's TextField becomes first responder?
Any advice appreciated.

The tableView should scroll to display the footer if it is firstResponder, so that might be a good place to tuck the toolbar.
Otherwise if you are manually moving your toolbar you can use notifications to manage the appearance. Here is from the Xcode docs:
Keyboard Notifications
When the system shows or hides the keyboard, it posts several keyboard notifications. These notifications contain information about the keyboard, including its size, which you can use for calculations that involve moving views. Registering for these notifications is the only way to get some types of information about the keyboard. The system delivers the following notifications for keyboard-related events:
UIKeyboardWillShowNotification
UIKeyboardDidShowNotification
UIKeyboardWillHideNotification
UIKeyboardDidHideNotification
The tableView footer is probably less code.
Good luck,
Damien

For make toolbar above your keyboard here is the most easy way..

Related

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!

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.

UIKeyboard will change frame with interactive keyboard dismiss, not called continuously

I am trying to use the UITableView.keyboardDismissMode = UIScrollViewKeyboardDismissMode.Interactive, to be able to drag my keyboard up and down. However I can't find any way to track the keyboard frame to update my tableView frame and messaging view. I am simply trying to replicate the standard iMessage behaviour. Given the name, I would have thought that UIKeyboardWillChangeFrameNotification would have been perfect for tracking the keyboard frame changes, but it only notifies when the gesture ends and the keyboard animates up or down.
I'm not sure if this will work but you could try to track the drag progress via the panGesture property on UIScrollView in your tableView. It wouldn't be a direct tracking of the keyboard frame, but if you know the keyboard's height and the progress/offset of the pan, you might be able to math your way around the problem.
The best approach for interactive dismissal is to use the "UIKeyboardDidShowNotification" and "UIKeyboardWillHideNotification" system notifications. When the selector is called you update the table's bottom inset. NOT the constraints. Updating the inset will give you a beautiful smooth keyboard dismissal experience.

Is it possible to slide in the keyboard from the side, rather than the bottom

When a control becomes the First Responder, normally the keyboard slides in from the bottom. How can I change that behavior and make it slide in from the left or the right instead? It makes much more sense for the particular UI that I'm working on.
Thanks
You could try to move the keyboard frame intercepting the UIKeyboardWillShowNotification event.
For retrieving the keyboard frame refer to this answer or this other one.
You could create your own view which functions as a keyboard.

How to make keyboard move along with scrollview?

I have a scrollview and a searchbar in a controller. And I want the keyboard move along with the scrollview when the scrollview is being dragged. Just as when edit a message on iphone.
So what should I do and I will appreciate it if you can give me some code.
What I mean is when the searchbar is the first responder,there will be a keyboard ha ?
And if I scroll the scrollview ,the keyboard will move along with it.
Some one said I should listen some notification. Is it right?
Thank you very much.
You cannot move a keyboard along with the view.You can only change position of the view underneath it.Therefore, If you wish to move the keyboard along with the scroll....All You need to do is to make your own custom keyboard!!!!!

Resources