I’m making a layout which has a scroll view and a input field beneath the scroll view covering all of the screen and whenever i touch the input field the keyboard poops up and overlaps the inputfield and scroll view i want to move my layout up by height of the keyboard so my layout exactly pops up the keyboard. I’m using this code but it is not giving me the exact value of the keyboard height in ios. Please find the code attached.
Moreover I specifically need it for iOS
I’m getting wierd values so it pushes my keyboard way upto center and with some gap between my layout and keyboard.
public float m_bottom;
public RectTransform ViewToMove;
[SerializeField]bool move;
public void FixedUpdate(){
if (TouchScreenKeyboard.visible) {
TouchScreenKeyboard.hideInput = true;
m_bottom = (TouchScreenKeyboard.area.height / 2) - 85f;
Debug.Log ("keyboard height and y" + TouchScreenKeyboard.area.height + " bottom " + m_bottom);
ViewToMove.offsetMin = new Vector2 (0, m_bottom);
ViewToMove.offsetMax = new Vector2 (0, 0);
} else
MoveDown ();
}
public void MoveDown(){
ViewToMove.offsetMin = new Vector2 (0,0);
ViewToMove.offsetMax = new Vector2 (0,0);
Debug.Log(ViewToMove.offsetMax +" "+ ViewToMove.offsetMin);
}
This is my hierarchy