D-A UK
D-A UK

Reputation: 1174

Showing the textfield directly above keyboard when editing

I would like to try and make the text field appear above the keyboard when in editing mode, as shown in this picture, which is in the app Clash of Clans:

enter image description here

Is this achievable through some code or doing stuff in the Interface Builder, or have Supercell (makers of Clash of Clans) done this themselves?

Upvotes: 1

Views: 211

Answers (1)

pbodsk
pbodsk

Reputation: 6876

You should look into the inputAccessoryView.

As it says here:

This property is typically used to attach an accessory view to the system-supplied keyboard that is presented for UITextField and UITextView objects.

You add the inputAccessoryView to the individual UITextField and UITextView views you have on your page, meaning that you can have separate inputAccessoryViews for the various textfields if so desired.

So in your case you would need to create your own view containing a UITextField and that checkmark button you have on the right and then add that view as a inputAccessoryView to your textfields and then it should appear right above your keyboard.

Hope that is enough to get you started, now you at least know that you should search for inputAccessoryView to see what can be done :)

Upvotes: 1

Related Questions