Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create text field with keyboard in Xcode

Is there any way to make a text field with keyboard (such as Twitter or Whatsapp)?

I tried to find some help from Google but I could not.

Text field with keyboard

Can anyone help me with this issue or at least to direct me where I can find some info?

like image 322
Ahmed.S.Alkaabi Avatar asked May 02 '26 05:05

Ahmed.S.Alkaabi


1 Answers

You can use the built-in UITextField for the text, but I assume your problem is with getting the field to rise with the keyboard when the user selects it.

This is a bit of a tricky problem, but the general solution is to use a UIScrollView and tell the keyboard to scroll when the user selects the field. This is especially important in iOS 8, which introduces custom keyboards; because third party keyboards can be any height, you can no longer hardcode the default keyboard height to scroll to.

Apple describes how to use this approach under "Moving Content That Is Located Under the Keyboard" in their "Text Programming Guide for iOS."

like image 131
AstroCB Avatar answered May 04 '26 22:05

AstroCB



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!