Detect if UIKeyBoard is Showing [duplicate]

2019-02-26 22:34发布

This question already has an answer here:

I'd like to detect whether or not the keyboard is showing. I've found a few other posts that traverse the subviews of UIWindow to find the keyboard, but if that is the only way then I'll figure out something else. I suppose I could also observe the UIKeyboard notifications, but I'm guessing there is a cleaner solution out there.

1条回答
贼婆χ
2楼-- · 2019-02-26 23:02

I am not sure what's "dirty" in observing UIKeyboard notifications but it definitely beats traversing UIWindow hierarchy.

查看更多
登录 后发表回答