ATTENTION: Recently some apps got rejected (but some didn't) because of messing with the status bar hierarchy. Therefore be warned that using MTStatusBarOverlay could lead in an rejection of your app. As a result of this I will currently not put any more work into MTStatusBarOverlay until the situation is clear, whether this is still allowed or not. Sorry for that, I will keep you updated!
Update 28.4.11: Recently an app got approved using MTStatusBarOverlay, so I really don't know what's going on currently. Use at your own risk!
Update 8.6.11: I got quite a few messages from people successfully using MTStatusBarOverlay in their apps that got submitted recently. As expected Apple now uses the area of the statusbar for their own global notifications in iOS 5, we will see if this influences rejections.
If you use MTStatusBarOverlay in your app, please drop me a line so that I can add your app here!
UIStatusBarStyleDefault (left: full size, right: shrinked)
This class provides a custom iOS (iPhone + iPad) status bar overlay window known from Apps like Reeder, Google Mobile App or Evernote. It currently supports touch-handling, queuing of messages, delegation as well as three different animation modes:
- MTStatusBarOverlayAnimationShrink: When the user touches the overlay the overlay shrinks and only covers the battery-icon on the right side
- MTStatusBarOverlayAnimationFallDown: When the user touches the overlay a detail view falls down where additional information can be displayed. You can get a history of all your displayed messages for free by enabling historyTracking!
- MTStatusBarOverlayAnimationNone: Nothing happens, when the user touches the overlay
MTStatusBarOverlay currently fully supports two different status bar styles, which also can be changed in your app (MTStatusBarOverlay will adopt the style and will be updated the next time you show it):
You can use the custom status bar like this:
MTStatusBarOverlay *overlay = [MTStatusBarOverlay sharedInstance]; overlay.animation = MTStatusBarOverlayAnimationFallDown; // MTStatusBarOverlayAnimationShrink overlay.detailViewMode = MTDetailViewModeHistory; // enable automatic history-tracking and show in detail-view overlay.delegate = self; overlay.progress = 0.0; [overlay postMessage:@"Following @myell0w on Twitter…"]; overlay.progress = 0.1; // ... [overlay postMessage:@"Following myell0w on Github…" animated:NO]; overlay.progress = 0.5; // ... [overlay postImmediateFinishMessage:@"Following was a good idea!" duration:2.0 animated:YES]; overlay.progress = 1.0;
Adding MTStatusBarOverlay to your project
MTStatusBarOverlay is compiled as a static library. You have two options for integrating it into you own project, after cloning the MTStatusBarOverlay git repository with the terminal-command:
git clone git://github.com/myell0w/MTStatusBarOverlay.git
First option: copy files
- Just copy over the files MTStatusBarOverlay.h and MTStatusBarOverlay.m to your project.
- import "MTStatusBarOverlay.h" everywhere where you want to use it
- There is no step 3 :)
Second option: Xcode dependent project
- Locate the "MTStatusBarOverlay.xcodeproj" file and drag itonto the root of your Xcode project's "Groups and Files" sidebar. A dialog will appear -- make sure "Copy items" is unchecked and "Reference Type" is "Relative to Project" before clicking "Add".
- Add MTStatusBarOverlay as a direct dependency (Xcode 3) or target dependency (Xcode 4) of your target
- Drag libMTStatusBarOverlay.a onto the section 'Link Binary with Libraries' of your target
- Finally, you need to tell your project where to find the MTStatusBarOverlay-header. Open your "Project Settings" and go to the "Build" tab. Look for "Header Search Paths" and double-click it. Add the relative path from your project's directory to the MTStatusBarOverlay-directory.
- You are good to go, just #import "MTStatusBarOverlay.h" everywhere where you want to use it.
- When using UIStatusBarStyleBlackTranslutient the overlay is black opaque
- User interaction in detail view is not possible yet
UIStatusBarStyleBlackOpaque (left: activity indicator, right: finished-indicator)
UIStatusBarStyleDefault, detail view visible
UIStatusBarStyleBlackOpaque, Progress visible