iOS: How to access the `UIKeyboard`?

后端 未结 6 934
执念已碎
执念已碎 2020-12-06 07:31

I want to get a pointer reference to UIKeyboard *keyboard to the keyboard on screen so that I can add a transparent subview to it, covering it completely, to ac

6条回答
  •  情话喂你
    2020-12-06 07:53

    Under iOS 8 it appears you have to jump down the chain more than in the past. The following works for me to get the keyboard, although with custom keyboards available and such I wouldn't rely on this working unless you're running in a controlled environment.

    - (UIView *)findKeyboard {
        for (UIWindow* window in [UIApplication sharedApplication].windows) {
            UIView *inputSetContainer = [self viewWithPrefix:@"

提交回复
热议问题