Difference between revisions of "Libstatusbar"
(→Icons: clean up all the icon sizes stuff)
(→Icons: actually gray despite the naming scheme)
|Line 92:||Line 92:|
Revision as of 10:27, 29 April 2016
libstatusbar is a library supporting status bar modifications.
The readme explaining iOS 7.x support is viewable on the project page on Github.
How to use within a tweak
First download the LSStatusBarItem.h header file. To compile on modern toolchains, the first line must be edited to instead be the following:
typedef NS_ENUM(NSInteger, StatusBarAlignment)
Create a constructor function in your tweak. You need to first ensure libstatusbar is loaded, otherwise the following code most likely won’t work (depending on whether your tweak is loaded after libstatusbar by Substrate, and whether another tweak loaded before yours has already done this).
Use of dlopen() will require you to also
After this, you can proceed to create a status bar item. Here is an example:
statusBarItem = [[%c(LSStatusBarItem) alloc] initWithIdentifier:@"com.malcolmhall.InsomniaPro" alignment:StatusBarAlignmentRight]; statusBarItem.imageName = @"InsomniaPro";
The imageName defines what image to look for. See below for naming conventions.
The item will be visible by default. You can control this by setting the
statusBarItem.visible = NO;
The last thing you need to do is add a dependency on libstatusbar in your package’s control file. Obviously none of this will work if it’s not installed. That might look something like:
Depends: mobilesubstrate, libstatusbar
It’s also worth noting that the libstatusbar API is usable from pretty much any process that has permission to do inter-process communication. This includes apps, daemons, and command line tools.
|iOS Version||Image Name||Status Bar Color||Glyph Color||Height (Points)||Location||Notes|
|2.0 – 3.2||Default_Name.png||Silver||Colored||20||SpringBoard.app||Supported by libstatusbar on newer iOS versions for backwards compatibility. Retina is not supported, even on iOS 4 and newer.|
|4.0 – 5.1||Silver_Name.png||Silver||Colored||UIKit.framework||Silver status bar was removed in iOS 6.|
|4.0 – 6.1||Black_Name.png||Black||Gray|
|5.0 – 5.1||ColorOnGrayShadow_Name.png||Silver||Colored||Silver status bar was removed in iOS 6.|
|5.0 – 6.1||WhiteOnBlackEtch_Name.png||Black||Gray|
|WhiteOnBlackShadow_Name.png||Linen||White||Used in the notification center.|
|7.0 –||Black_Name.png||None||Varies||The original glyph should be black. The status bar tints it accordingly.|
|Black_Name_Color.png||Colored||20||Custom style supported by libstatusbar. It disables the glyph tinting and allows you to use color.|
Images can be as wide (or thin) as desired. In all status bar styles listed above, there is usually some margin above and below the glyph. The dimensions you should use really depend on what looks best for the glyph. Take a look at the built in status bar icons, and possibly some from other tweaks, in your favorite image editor to see how they have been designed.
Some example sizes from the built-in icons are:
|iOS Version||Image Name||Size (Points)|
To see a full tutorial on how to use this library in your tweak, check out this video by Sassoty