/// show the custom statusBar
//
- (void)btn1:(id)sender
{
if(self.win && self.win.frame.origin.y == 0)
return;
if(self.win == nil)
{
self.win = [[UIWindow alloc] initWithFrame:CGRectMake(0, -20, 320, 20)];
self.win.windowLevel = UIWindowLevelAlert;
self.win.backgroundColor = [UIColor redColor];
}
[self.win makeKeyAndVisible];
// show it with animation
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.3];
self.win.frame=CGRectMake(0,0,320,20);
[UIView commitAnimations];
}
/// hide it:
//
- (void)btn2:(id)sender
{
if(self.win == nil || (self.win && self.win.frame.origin.y == -20))
return;
[UIUGetMainWindow() makeKeyAndVisible];// MainWindow: [[[UIApplication sharedApplication] windows] objectAtIndex:0].
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.3];
self.win.frame=CGRectMake(0,-20,320,20);
[UIView commitAnimations];
}