简体   繁体   English

iOS状态栏:如何在那里显示一些文字

[英]iOS status bar: how to show some text there

In top-most bar of iPhone screen, I don't know it's called status bar or not. 在iPhone屏幕的最顶层栏中,我不知道它是否被称为状态栏。 I want to write some text on that after I finish some actions, is there any API for that or example? 在完成某些操作后,我想写一些关于该文本的文本,是否有针对该示例或示例的API?

You should find the gitHub project MTStatusBarOverlay very useful. 您应该发现gitHub项目MTStatusBarOverlay非常有用。 Drop-in class that allows easy yet powerful creation of custom status bar overlays. Drop-in类,允许轻松而强大地创建自定义状态栏叠加。 Some other classes that achieve the same thing can also be found here. 其他一些实现同样功能的类也可以在这里找到。

Those saying this goes against good iOS design, I think that if used sparingly and only where appropriate, it can help de-clutter apps that have a lot of information already displayed on-screen. 那些说这违反了良好的iOS设计,我认为如果谨慎使用并且只在适当的地方使用,它可以帮助消除已经在屏幕上显示大量信息的应用程序。

EDIT: A good and current example of this is largely hyped email app Mailbox . 编辑:这是一个很好的和当前的例子,主要是炒作电子邮件应用程序邮箱 It uses status bar overlays to indicate progress of running tasks, freeing up the whole screen to display content! 它使用状态栏覆盖来指示正在运行的任务的进度,释放整个屏幕以显示内容!

The status bar is meant for the operation system's use only - this means that it can show the time, network activity indicator, battery status and such but it is not customizable. 状态栏仅供操作系统使用 - 这意味着它可以显示时间,网络活动指示器,电池状态等,但不能自定义。 I imagine that this is not exactly the case if you're talking about development for a jailbroken environment though. 我想如果你正在谈论越狱环境的发展,情况并非如此。

An interesting option for you might be creating a custom status bar . 一个有趣的选项可能是创建自定义状态栏

UPDATE UPDATE

Since I wrote this answer, I've come across several projects on Cocoa Controls that might help: 自从我写这个答案以来,我遇到了几个可能对Cocoa控件有帮助的项目:

KGStatusBar KGStatusBar

FDStatusBarNotifierView FDStatusBarNotifierView

TWStatus TWStatus

Seems as though this has become "sexy" since the MailBox app :) 从MailBox应用程序看起来好像已经变得“性感”:)

An alternative solution is to display a secondary status bar underneath: 另一种解决方案是在下面显示辅助状态栏:

iOS: Create a secondary status bar for displaying in-app messages iOS:创建用于显示应用内消息的辅助状态栏

隐可见

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM