I want to create a simple mobilesubstrate tweak that hides and shows status bar icons like battery or Carrier or wifi signal indecator. I've seen libstatusbar project but i can't find out how to hide iOS's icons. Is there any other way to do this without the use of this library? I just want to hide and show the default icons
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
Ok. Here is solution.
In your plist file add row:
Make a category on UINavigationBar with this content:
This will increase navigation bar for 20pt.
Then, make your custom view for status bar. e.g.
And you will have something like this:
Note, that you need to update values of your custom view every time (i.e. time label, battery, etc..) , so it would be better to make a separate class for your status bar, and make a infinite timer with 1 sec of tick and do your updates in timer's action.
may be you just need this?
And if you want just empty view on top of 20pt height, then make that and add to UIWindow, and shift down subview of UIWindow for 20 pt
Not possible using public API. You can only hide the entire status bar, not only certain elements of it.
For jailbreak, take a look at:
https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/UIKit.framework/UIStatusBarItem.h
In particularly, look at the following methods:
These methods are consulted whether iterms should appear or not. Return
NO
here to disable items.Here is what I use in my tweak:
Only problem - iOS uses integer values for status bar items and they're different on different iOS versions. You could test every iOS version and store values for each one of them but I found a better way.
I hook
SBStatusBarStateAggregator _setItem:(int)arg1 enabled:(BOOL)arg2
method. Then I call one of theSBStatusBarStateAggregator -(void)_update****
methods. For example, let's say I want to find location icon index. I callSBStatusBarStateAggregator -(void)_updateLocationItem
method. It then will call hookedSBStatusBarStateAggregator _setItem:(int)arg1 enabled:(BOOL)arg2
where I will store the index.I also hook
SBStatusBarStateAggregator -(void)_notifyItemChanged:(int)arg
. This method is called as part ofSBStatusBarStateAggregator -(void)_update****
call. When determing status bar icon index I simply ignore calls to it by returning without calling original implementation.And if you want to permanently hide some of the icons you still need to hook
SBStatusBarStateAggregator _setItem:(int)arg1 enabled:(BOOL)arg2
andSBStatusBarStateAggregator -(void)_notifyItemChanged:(int)arg
in order to ignore any iOS attempts to show hidden icons. For example, signal level and data/time are reanabled every time they're updated.That's all for iOS 7. On iOS 5-6 API is different but I use pretty much the same approach. To hide status bar item
I hook
SBStatusBarDataManager -(void)updateStatusBarItem:(int)item
to determine icon index and then callSBStatusBarDataManager -(void)_locationStatusChange
in case of location icon.