KeyboardLayoutGuide icon indicating copy to clipboard operation
KeyboardLayoutGuide copied to clipboard

Make the height difference in the keyboard guide reflect the key window’s safeAreaInsets instead of the owning view’s

Open ethanjdiamond opened this issue 8 years ago • 4 comments

Views that are placed inside of of the safe area and aren't touching the edges don't have a safe area. Since the keyboard takes into account safe area anyway, pulling safe area off of the owning view doesn't work sometimes. This fixes that issue.

ethanjdiamond avatar Jan 02 '18 01:01 ethanjdiamond

Hello @ethanjdiamond, thanks for your contribution!

As for the edit, I guess that keyWindow may not be the right thing to use here, because it actually can be a different window and not the one where the app's content is - that's especially the case when keyboard is presented. Can you please check if something like this works:

height -= owningView?.window?.safeAreaInsets.bottom ?? 0

maxkonovalov avatar Jan 03 '18 21:01 maxkonovalov

Good call. I'll test that out.

It also looks like this doesn't handle views who's bottoms aren't touching the bottom of the screen. I'll see if I can figure that out too.

ethanjdiamond avatar Jan 11 '18 02:01 ethanjdiamond

Hey @ethanjdiamond, I tried the PR on our project and got some odd results in some views (see screenshot attached) simulator screen shot - iphone x - 2018-08-17 at 09 56 52

I'm going to try to pinpoint the issue 🤓

Please excuse the super late reply! better late than never I guess xD

s4cha avatar Aug 17 '18 07:08 s4cha

Mmm actually I had edgesForExtendedLayout = [] for some reason that was screwing with the layout.

s4cha avatar Aug 17 '18 08:08 s4cha