iOS get Keyboard Window

前端 未结 4 1244
一生所求
一生所求 2021-01-13 00:16

So in iOS 7 I always got the Keyboard Window like this:

- (UIView *)keyboardView
{
    UIWindow* tempWindow;

    //Because we cant get access to the UIKeybo         


        
4条回答
  •  灰色年华
    2021-01-13 01:04

    On iOS 13, we can get keyboard window like this:

    let windows = UIApplication.shared.windows
    if let keyboardWindow = windows.first(where: { NSStringFromClass($0.classForCoder) == "UIRemoteKeyboardWindow" }) {
      return
    }
    

提交回复
热议问题