Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading bar over status bar?

I've seen several apps do this, and i've been wondering how it's done. If you look at the Wunderkit app, when it loads something, there's a blue animated bar that slides down to cover the status bar until it finishes loading. How is this done?

like image 482
Sophia Tung Avatar asked Feb 04 '12 06:02

Sophia Tung


1 Answers

you can subclass UIWindow. And set it windowLevel = UIWindowLevelStatusBar;

code:

@interface CHLoadingWindow : UIWindow

@implementation CHLoadingWindow
- (id)init
{
  self = [super init];
  if (self) {
    self.windowLevel = UIWindowLevelStatusBar;
    // then draw your UI
  }
  return self;
} 
@end

use it:

CHLoadingWindow *loading = [[CHLoadingWindow alloc] init];
[loading makeKeyAndVisible];

discover it:

[loading release];
loading = nil;

[[[[UIApplication sharedApplication] windows] objectAtIndex:0] makeKeyWindow];
like image 82
Seamus Avatar answered Oct 26 '22 18:10

Seamus