Jak ukryć pasek stanu z animacją w iOS 7?
Od czasu wdrożenia systemu iOS 7 nie mogę pokazać ani ukryć paska stanu z animacją, tak jak w systemie iOS 6. Na razie używam NSTimer, aby kontrolować, kiedy się ukrywać.
oto mój kod:
- (void)hideStatusBar{
_isStatusBarHidden=YES;
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
- (void)showStatusBar{
_isStatusBarHidden=NO;
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
}
//===================
_controlVisibilityTimer = [[NSTimer scheduledTimerWithTimeInterval:4 target:self selector:@selector(hideStatusBar:) userInfo:nil repeats:NO] retain];
Ale niestety sposób ukrywania paska stanu wydaje się nieco szorstki, nie zanika. Czy ktoś ma rozwiązanie tego problemu?
AktualizacjaRozwiązałem problem ukrywania, korzystając z rozwiązania @hahaha. Potrzebuję tylko widoku, aby był tłem paska stanu, oto mój kod.
AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];
self.StatusBarOrange = [[UIView alloc] initWithFrame:CGRectMake(0, 0, appDelegate.window.frame.size.width, 20)];
[self.StatusBarOrange setBackgroundColor:[UIColor orangeColor]];
[appDelegate.window.rootViewController.view addSubview:self.StatusBarOrange];
a teraz wszystko działa doskonale!