Search code examples
iosswiftuitableviewuitextfieldiqkeyboardmanager

How to add text field auto suggestions in a drop down list?


I have one Billing Address page in the app. I have to remember all text field data adds by the user and show them in a drop down list.

I have to create a table view on the bottom of the text fields. I am also using IQKeyboardManager for maintaining text fields when the keyboard appears.

So, when the keyboard appears, the table view is overlapping on the back of keyboard. How to resolve this issue?

I am also attaching the screenshot:

IQKeyboardManager toolbar in front of text field


Solution

  • As i doing some search i found keyboardDistanceFromTextField property of IQKeyboardmanager class. You can set disctance of keyboard for the specific textField object using following code:

    YourDropDowntextFiled.keyboardDistanceFromTextField = 250;
    

    So make use of this line of code for your textfiled and you can easily show the drop-down list visible.

    I have checked in Demo look like following. One i did not add keyboardDistanceFromTextField so it just appear after keyboard and other i apply propery so it will show big distance from the keyboard.

    enter image description here