[iOS]hide StatusBar programmatically

以程式動態隱藏iOS StatusBar

BOOL conditionIsTrue;

-(void) someEventTriggerTheCondition:(BOOL)enable {
    // 某些條件成立...
    self.conditionIsTrue = enable;

    [UIView animateWithDuration:0.25 animations:^{
        [self setNeedsStatusBarAppearanceUpdate];
    }];
}

// 此方法請參考Apple文件
- (BOOL)prefersStatusBarHidden {
    return keyboardShow;
}

沒有留言: