美文网首页
iOS16 UIRemoteKeyboardWindow找不到

iOS16 UIRemoteKeyboardWindow找不到

作者: wps_pro | 来源:发表于2022-11-15 15:22 被阅读0次

    背景

    iOS16之后根据UIApplication.shared.windows.last获取UIRemoteKeyboardWindow方式失效,导致表情包长按预览图到了InputView之下,打印其并不在UIApplication.shared.windows之中

    临时获取UIRemoteKeyboardWindow解决方案

    //注:emojiBoardView为TextField的inputView
    if let keyBoardWindow = vc.emojiBoardView.superview?.superview?.superview as? UIWindow {
                        keyBoardWindow.windowLevel = keyBoardWindow.windowLevel + 1
                        keyBoardWindow.addSubview(self)
                        self.snp.makeConstraints { make in
                            make.edges.equalToSuperview()
                        }
    }
    

    有没有更好的方法?

    相关文章

      网友评论

          本文标题:iOS16 UIRemoteKeyboardWindow找不到

          本文链接:https://www.haomeiwen.com/subject/zxydxdtx.html