Skip to content

ExtraKeys/kb-layout-issue-demo-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-window KB Layout Issues

NSNotificationCenter

If application in app delegate (application:didFinishLaunchingWithOptions:) subscribes to UIKeyboardDidChangeFrameNotification.

[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_kbFrameChanged:) name:UIKeyboardDidChangeFrameNotification object:nil];

In _kbFrameChanged there is no way to detect for what window (UIWindowScene) coordinates UIKeyboardFrameEndUserInfoKey frame is.

So there is no way to proper calculate screen coordinates for keyboard.

Note: This is only occurs when app has 2 or more UIWindowScenes on the screen.

Posible solution: Add UIScreenKeyboardFrameEndUserInfoKey

UIKeyboardLayoutGuide

We suspect that TrackingLayoutGuide for keyboard also uses UIKeyboardDidChangeFrameNotification and it is also affected by this issue.

On following screenshot is example of this app. 2 and 3 windows are separate window scenes. Red view is constrained with UIKeyboardLayoutGuide.

screenshot

[[_kbTrackerView.leadingAnchor constraintEqualToAnchor:self.view.keyboardLayoutGuide.leadingAnchor] setActive:YES];
[[_kbTrackerView.widthAnchor constraintEqualToAnchor: self.view.keyboardLayoutGuide.widthAnchor] setActive:YES];
[[_kbTrackerView.heightAnchor constraintEqualToAnchor: self.view.keyboardLayoutGuide.heightAnchor] setActive:YES];
[[_kbTrackerView.bottomAnchor constraintEqualToAnchor:self.view.keyboardLayoutGuide.bottomAnchor] setActive:YES];
self.view.keyboardLayoutGuide.followsUndockedKeyboard = YES;

And layout system also confuses between windows and apply wrong constrains to _kbTrackerView (red view).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%