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

Author
Message
xGEKKOx
AGK Master
15
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:

template.h
Add this line:
extern bool keyb_open;

template.cpp
Add this line:
bool keyb_open = false;

UntitledViewController.h
Add those lines:


UntitledViewController.m
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...


Important!!!!
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
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd May 2013 19:55
Thank you very much.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-03-28 14:11:05
Your offset time is: 2024-03-28 14:11:05