Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / [Tutorial] Check Wireless/Virtual Keyboard to scroll UITextField

AGK Master
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 22nd May 2013 19:12 Edited at: 22nd May 2013 19:31
As promised i wanna help you all because i found some troubles solving this issue.
In fact for this, Apple reviewers rejected my console game "Hack Online".
Let's start!

Now we need a BOOL to track keyboard open or not. Usually i use it in the template.h with the extern method, but you can do how you want:

Add this line:
extern bool keyb_open;

Add this line:
bool keyb_open = false;

Add those lines:

Now in the .m file we have some things to do...
The first is this, add those lines (don't mind if i call different functions, if you wanna rename it to don't get confused you can):

Now we need to add the observer functions...

This is the part that do the trick...
We need to add a inputAccessoryView to the UITextField we use like this:

This will create an invisible keyboard that will be recognized with a size of 0 in the keyboardDidShow.
In this way he found 0 and know it is an external keyboard.

The trick is when the extrenal keyboard close the virtual keyboard, it return to the keyboardDidShow with NOSENSE!!!!! (I think an Apple bug)

Well in this way you can handle it.
Is not very beautiful to see the white part when closing, but better than nothing!!!

And finally ENJOY!!!

Long life to Steve!
Ancient Lady
Valued Member
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd May 2013 19:55
Thank you very much.

Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2023-11-28 22:57:09
Your offset time is: 2023-11-28 22:57:09