casparjespersen
casparjespersen

Reputation: 3830

Notification bar in iPhone apps

I would like to create a notice bar, like the active-phone-call notice bar, whenever my user losses connection to my server.

Is there an easy way to do this? Can't find it in the API, but there must be some supported way - or should I program it manually?

example image

Example: The difference being I want it to be active while in my app and I want to define the text myself.

Upvotes: 3

Views: 1123

Answers (3)

Gobot
Gobot

Reputation: 2480

Here's a decent library I came across the other day called "KGStatusBar, A minimal status bar for iOS." https://github.com/kevingibbon/KGStatusBar. I haven't tried it yet but glancing at the source it seems solid.

Upvotes: 1

tilo
tilo

Reputation: 14169

There is no direct API available for doing this, but you can change the status bar color like this

self.window.backgroundColor = [UIColor colorWithRed:0.78f green:0.13f blue:0.11f alpha:1];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];

and add another view below with your custom text.

Or, if you just want so put some information in the status bar with a custom color, take a look at KGStatusBar or MTStatusBarOverlay.

Upvotes: 2

Lefteris
Lefteris

Reputation: 14667

You can set a window at the statusbar level and actually replace the phone's status bar with your own, if this is what you are asking. The way this can be implemented is found here

However keep in mind that your app may be rejected by Apple in that case.

A lot of apps, are using this for showing for a brief moment some information on the status bar position, then they show the status bar again. The Groupon App was actually doing this and was displaying a UIPageControl when you swiped through their different UITableViews to show you how many UITableViews are available.

Upvotes: 2

Related Questions