(area used by) Keyboard in iOS 15.x

Mark Smith marksmithhfx at gmail.com
Mon Dec 27 07:05:05 EST 2021


Thank you Sean and Jacque, 

I’ve not had a chance to work on a complete solution but thought I would make a test run to see what “the effective working screenrect” was returning and as the following indicates, it does in fact take into consideration the keyboard. I just coded up one line to  run whenever the status of the keyboard changed and tried it both with and without the “predictive” option turned on. As you can see, it was very sensitive to this change…

without predictive:

9:37:14 PM keyboardActivated 0,0,375,451
9:37:15 PM keyboardDeactivated 0,0,375,667
9:37:18 PM keyboardActivated 0,0,375,451
9:37:19 PM keyboardDeactivated 0,0,375,667
9:37:19 PM keyboardActivated 0,0,375,451
9:37:23 PM keyboardDeactivated 0,0,375,667


with predictive: 

9:56:54 PM keyboardActivated 0,0,375,407
9:56:55 PM keyboardDeactivated 0,0,375,667
9:56:55 PM keyboardActivated 0,0,375,407
9:56:57 PM keyboardDeactivated 0,0,375,667

In my particular case not all 4 value are immediately useful. For example, I have a fixed header and footer that need to be accommodated so the correct “useable” rect for me is:

0,69, 377, 618 (for no predictive)
0,69,377,456 ( for predictive)

but this can easily be accommodated since the header/footer values don’t change. The beauty is I now have a rect lower bound (ie. keyboard height) that actually reflects where the keyboard is. 

Brilliant!! Thank you both,

Mark

Sean, I tried iPhoneSafeAreaInsets() but it appears it returns a constant set of values regardless of keyboard position on my iPhone 12

11:51:22 AM keyboardActivated 0,47,0,34
11:51:22 AM keyboardDeactivated 0,47,0,34
11:51:26 AM keyboardActivated 0,47,0,34
11:51:26 AM keyboardDeactivated 0,47,0,34

And didn’t change when I added / subtracted “predictive”. So, just the available usable space at the top and bottom of the screen. I haven’t adjusted my app yet to fully take advantage of the larger screen on a 12 (it was developed on a 6S) but when I get to more response design this will be useful to know where the usable top and bottom are. 

Cheers!!







> On Dec 25, 2021, at 5:25 PM, Sean Cole via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Another addendum to this I just noticed is in the latest RC, LC9.6.6RC1,
> which has iphoneSafeAreaInsets for discerning the safe area from furniture
> like the notch and so on. I haven't tested this but that may also include
> things like the keyboard and predictive areas. I just thought it was worth
> a mention here.
> 
> Regards
> Sean
> 
> On Fri, 24 Dec 2021 at 20:44, J. Landman Gay via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> On 12/24/21 2:16 PM, Sean Cole via use-livecode wrote:
>>> Just adding to what Jacquie wrote, there is also the effective working
>>> screenrect.
>> 
>> You're right, "effective" was added to account for the keyboard on mobile.
>> I'd start with that.
>> 
>> --
>> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
>> HyperActive Software           |     http://www.hyperactivesw.com
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list