How to get keyboard height in viewDidLoad not after keyboard opens - ios

I want to set a view frame to be above the keyboard.
That it will not need to change height/location after keyboard appears.
Is there a way to get keyboard height in ViewDidLoad and not after keyboard appears?
Thanks
with and without keyboard the view should always be in the same place.

There are fixed sizes for Keyboard heights in iOS.
Here's some documentation that would help you.
http://www.idev101.com/code/User_Interface/sizes.html
You can just check what device is being using and find its keyboard height accordingly.

Related

how to change position of a Number Pad?

By default, if you set a UITextField keyboard type to Number Pad when it is displayed, it appears on the bottom of the screen. My problem is, if the controller has a toolbar, they can not appear when the keyboard appears. I want the number pad to appear on above toolbar. Can I change the position of it?
Any ideas?
first
second
No, you're not able to change the position of the system keyboard. You can however put the toolbar on top of the keyboard. There is a property on UIKeyboard that allows this. Look at inputAccessoryView.
You should listen for the various keyboard events, such as UIKeyboardWillShowNotification and adjust the constraints/frame of your toolbar accordingly. This will allow you to place your toolbar wherever you want when the keyboard is shown and dismissed.
Reference: https://developer.apple.com/library/content/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html

How to prevent keyboard from dismissing when device rotates?

I have an iPhone app that has a "contact picker" using a table view. If my "recipient" field is active and the keyboard is shown, then the device is rotated, the keyboard dismisses itself automatically.
How can I disable this functionality?
Turns out, my TokenView was reloading on rotation and not re-setting the firstResponder to it's textView, which caused the keyboard to hide.
Fixed the issue by adding a line to set the first responder to the TokenView's UITextView in it's 'reloadData' function.

Keyboard overlapping TextField in landscape orientation

Enter Account Number and Enter Branch Id Textfields are working well at portrait mode when keyboard is appearing.I dissmiss it in Verify button as i don't get return key at Number pad.i do it programmatically.
But in landscape mode the keyboard is hidding my TextFields.What to do now?Any help is a blessing.
This is a common problem, you can easily manage also. If the text fields are within the table view you can scroll the table view when the keyboard appears, if not you should embed the all the controls within a scroll view and scroll it. Use the keyboard notification to detect keyboard appearance and dismissal.
Basically, you register to receive the UIKeyboardWillShowNotification and the UIKeyboardWillHideNotification, then you manually scroll the view to compensate.
pls refer this link
Making a UITableView scroll when text field is selected

IOS scrolling text view in popover not showing all of text upon device rotation

I have an iPad popover containing a scrolling text view that is initiated via a custom toolbar button item through a IB defined segue. Upon device rotation, the size of the popover is changed in code via the popoverContentSize property to handle the changes from portrait to landscape orientation and vice-versa. The scrolling view contains a number of equivalent pages of attributed text that is programmatically added to the scrolling text view.
All of the text appears just fine when in the portrait orientation, but when I change to the landscape orientation the last paragraph or so of the text does not appear in the rotated scrolling text view. What am I missing or not doing? How can I make all of the text appear in the landscape view as well? I appreciate any advice that anyone can give.
You probably didn't change the frame of the textview when you changed size of the popover.
You need to make the frameSize and contentSize of the textView as dynamic based on the screen width and height (orientation) and refresh the values on rotation of device.

UIWebView hidden by keyboard

I have iPad app with view and uiwebview in it. It is on the bottom with size smaller than keyboard (e.g. 300x200). In webview is page with form loaded.
When I tap into some textfield, keyboard pops up and hides whole uiwebview. With iOS simulator and slow animation mode I can see, that webview is scrolled, but when it is smaller then keyboard and at the bottom, it is useless. Webview is covered with keyboard.
I have mastered moving hidden content by keyboard according managing keyboard documentation but when i set scrollview offset, webview still do the scrolling and scrolls text input away. There isn't way of setting webview offset.
Also I found in UIWebView class reference important note that embed webview in scrollview won't work correctly.
It seems to me i have come across easy problem but with no solution on the Internet. So am I first who wants to have uiwebview smaller than fullscreen? Is it app Store correct to have small uiwebview? What to do if UIWebView is hidden by keyboard?
Thanks for any notes and suggestions.
You can hide the keyboard when the webView is scrolled, try this:
self.webView.scrollView.keyboardDismissMode =UIScrollViewKeyboardDismissModeOnDrag;
What i would do is Keyboard notifications. You can scroll the view upwards using the methods provided by the UIView class nad this link should help you out greatly.
Keyboard Hiding Screen

Resources