iOS: 在键盘之上显示一个 View

时间:2014-08-26 13:25:46   收藏:0   阅读:281

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

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

原文:http://www.cnblogs.com/yangmx/p/3936829.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!