Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Instagram customize the UIKeyboard returnKey to an '@' and a '#"?

The most recent version of the Instagram iOS app does something interesting. When writing in a text field (e.g., posting a comment), the UIKeyboard's return key has been replaced by two keys: an @ key and a # key. Here's a screenshot:

Screenshot of Instagram keyboard

I would like to know how they do this. As far as I can tell, @ and # keys behave like normal keys: they disappear in keyboards that do not usually have returnKey (such as the emoji keyboard), etc.

The only thing that occurs to me as of now is that the app is getting a reference to the UIKeyboard and looping through the subviews, finding and hiding the returnKey, then finding and moving the @ and # keys. Any other ideas?

like image 238
cbrauchli Avatar asked Aug 01 '12 02:08

cbrauchli


People also ask

Can you customize keyboard iPhone?

You can adjust the onscreen (software) keyboard on iPhone. If you use an external (hardware) keyboard with iPhone, you can customize keyboard shortcuts and change settings such as the key repeat rate.

How do I reduce the size of the keyboard on my iPhone?

Tap and hold on the emoji or globe icon on the keyboard. You will see three keyboard icons . Tap the left icon to shrink the keyboard to the left or the right icon to shrink the keyboard to the right. Tap the middle icon to return to the full-sized keyboard.


1 Answers

That seems to be a text field whose keyboardType is set to UIKeyboardTypeTwitter, first introduced in iOS 5. It's exactly the same keyboard layout that is used by Tweet Sheets in iOS 5, with the return key being replaced by the @ and # keys respectively.

Since Instagram happens to use @ for referring to users and # for tagging posts, just like Twitter, I'm guessing that they're borrowing UIKeyboardTypeTwitter for convenient use with their own app.

like image 105
BoltClock Avatar answered Oct 21 '22 08:10

BoltClock