如 AlertView,当 show 一个 Alert 时,它会覆盖在 Keyboard 上面,不影响显示的效果。那么我们自己创建的 View 如何像 Alert 那样不被键盘盖住呢?很简单,拿到 Application 的 最上面一个 window,把 View 加到这个 window 上,就可以了。

UIWindow *window = [[[UIApplication sharedApplication] windows] lastObject];
[window addSubview:view];

Stack Overflow

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-10-03
  • 2021-07-06
  • 2022-01-11
相关资源
相似解决方案