iOS7 - Status bar with specific color - ios

is it possible to change status bar text and battery icon to specific color, for example red color?
I have read some article about this, suggesting me to use setStatusBarStyle. But I don't have option to set to specific color.
So, is it possible to do this? Thanks in advance
EDIT :
I was trying to find the answer at apple dev forum, but unfortunately I can't find it. The available color for UIStatusBar in iOS7 is black and white.
Maybe you can try Sulthan's post below, but seems not easy, at least for me. Seems need so much effort for just simple color changing. So I don't think this is possible, at least in easy way.
Anyway, thanks for helping me :)

Warning - in general, changing the color will not be received well by App Store reviewers.
You can hide the default status bar and add your own. This would require displaying time, battery information, network state etc. It's not an impossible solution, not hard to implement but it will take time and it won't look exactly like the native status bar on all the devices.
You can show a partially transparent view over the white status bar and change the color this way. However, it will also change the color of the status bar background.
You can use undocumented API. Status bar is a system window (not returned by [UIApplication windows]) but there are ways to gain access to it (see, for example, Window Registry to gain access to all application windows). Then you can use reflection (obj.c runtime) to check which methods are available on the status bar and try to change the colors (see UIStatusBar and UIStatusBarWindow) It also might be possible to draw the native status bar into an image, replace white pixels with colored pixels and then draw the resulting image over the original status bar.

Related

Safe to change the status bar color to black?

Currently, my status bar color is white. I want to make it black because my app would look better that way. My question is, is it "safe" to do so, or does it go against Apple guidelines? Would my app not be approved?
You are allowed to use either of color statusbar in iOS.
From Apple doc.s
The visual style of the status bar’s text and indicators is either
light or dark, and can be set globally for your app or individually
for different screens. A dark status bar works well above
light-colored content and a light status bar works well above
dark-colored content.

iOS custom keyboard blur view as background

This is really simple, but maybe not easy?
I'm trying to build a custom keyboard app for iOS, and so far I've made a concept work pretty well. But I really want to have the whole container/background view to be a blur view (frosted glass effect built in iOS), much like the system keyboard. It's very subtle, but I really want that effect.
Any idea how to apply it? Help!
One solution I found (which is great but not ideal) is to simply set the background color of the ViewController to transparent. By giving it a color with alpha = 0, it has the same color as the system keyboard background.
But this doesn't let you go any further in terms of transparency, so the blur is very subtle.

How to access the system selected menu item blue color?

I'm working on an app that has a custom NSView on a NSStatusBar which performs all of the drawing when the user clicks it. But here's the problem, the color I'm currently drawing as the view's background color is not the same as the system blue color.
My app's color:
Twitter's menu item color (system):
As you clearly see, my blue color is way lighter than the system. This is the code I'm currently using (and worked perfectly on versions older than Yosemite):
[[NSColor selectedMenuItemColor] set];
NSRectFill(rect);
I've even tried color picking the menu item's color but it seems like the color is affected by the wallpaper below the menu bar.
Any ideas on how to achieve the system look?
As you said, in Yosemite, docks, status bars etc. are affected by whatever is behind them. Try enabling System Preferences > Accessibility > Display > Reduce Transparency and you'll see what your color looks like without this feature./
Here is an idea - Maybe you should use the Vibrancy effect and derive from NSVisualEffectView. I knew that I've seen a very similar thread somewhere here in the past, and it took me quite some time to find it. Here it is:
Trouble matching the vibrant background of a Yosemite NSMenuItem containing a custom view
I think Matthes' answer to that question would lead you to the resolution of your issue. Be sure to check it out. I hope it will help - Good luck and report back!

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: The difference being I want it to be active while in my app and I want to define the text myself.
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.
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.
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.

How to make a glowing bar effect in iOS like the one used when personal hotspot is on?

I'd like to use this effect (not necessarily blue) when I'm synching my app to my server. I've searched the interwebs and apple dev forums but to no avail.
Another way to do this (though it gives you very little control over how the double status bar looks) is to simulate an audio session. See the following question & answer: SBStatusBarController instance
There is no way to do this nicely as Apple does this. There are two ways to do at least something close to this:
You can try to set status bar style to UIStatusBarStyleBlackTranslucent and plea a little bit with background images under the status bar that will affect a color a little bit.
You can take a look through the code by following links — http://www.cocoabyss.com/uikit/custom-status-bar-ios/ and https://github.com/myell0w/MTStatusBarOverlay/ this two code samples implements an overlay above the status bar that fools a user. Achieved result maybe pretty close to what you show in your screenshot.

Resources