当我用 UIView 覆盖所有屏幕时,如何用 UIView 覆盖 UIStatusBar? (iPhone)
当我用 UIView 覆盖所有屏幕时,如何用 UIView 覆盖 UIStatusBar?
How to cover also the UIStatusBar with UIView when i cover all the screen with the UIView?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我也纠结了好久要怎么做!终于弄清楚了:)关键是将新窗口的 windowLevel 设置为非常高,以便它位于所有其他窗口/视图/状态栏等之上:
享受吧!
I was battling how to do this for a long time too! Finally figured it out :) The key is to set the windowLevel of your new window to really high so it lives on top of all the other windows/views/statusbar etc:
Enjoy!
您能做的最好的事情就是使用以下命令隐藏状态栏:
并在需要时再次显示它。
基本上,您可以随时
removeFromSuperview
删除视图。The best thing you can do is hide the status bar with:
and show it again when you need it.
You can basically
removeFromSuperview
any time you want to remove the view.如果您尝试创建类似
UIAlertView
的效果,我认为您无法做到这一点。您可以通过 http://bugreporter.apple.com 向 Apple 提交功能增强请求。If you're trying to create a
UIAlertView
-like effect, I don't think you can do this. You might file a feature enhancement request with Apple at http://bugreporter.apple.com.很好,但我做了这两个改变。将 1.0 添加到 UIWindowLevel 仍然会隐藏状态栏,我不知道为什么。
将 Statusbar userInteractionEnabled 属性设置为 NO 将确保当有人点击此状态栏时,您的滚动视图将滚动到顶部。
Nice, but I made these two changes. Adding 1.0 to UIWindowLevel still hides the status bar, and I have no idea why.
Setting the Statusbar userInteractionEnabled property to NO will ensure that your scroll views will scroll to top when someone taps on this statusbar.