Code Monkey home page Code Monkey logo

hbdstatusbar's Introduction

HBDStatusBar

官方提供了一套 API 来控制状态栏的显示和隐藏

- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation;

- (UIViewController *)childViewControllerForStatusBarHidden;

- (BOOL)prefersStatusBarHidden;

- (void)setNeedsStatusBarAppearanceUpdate;

这一套规则在没有使用 UINavigationBar 之前,是正常的,生活是美好的。但是一旦涉及到 UINavigationBar, 就令人抓狂了,经历过的都懂,无须多言。

本库因此而生,解决有 UINavigationBar 时,隐藏状态栏带来的各种问题。

Usage

使用 hbd_statusBarHidden 取代 prefersStatusBarHidden 使用 hbd_setNeedsStatusBarHiddenUpdate 取代 setNeedsStatusBarAppearanceUpdate

在需要隐藏状态栏的控制器中编写如下代码

#import <HBDStatusBar/UIViewController+StatusBar.h>

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.hbd_statusBarHidden = YES;
}

或者

- (BOOL)hbd_statusBarHidden {
    return YES;
}

这是声明式 API,其它不需要隐藏状态栏的页面什么也不需要做。

如果需要动态隐藏或显示状态栏,在设置 hbd_statusBarHidden 后调用 hbd_setNeedsStatusBarHiddenUpdate 即可。

本库可以和 UINavigationBar 友好相处

你仍然可以通过 preferredStatusBarUpdateAnimation 来指定状态栏显示或隐藏时的动画,仍然可以通过 childViewControllerForStatusBarHidden 来指定由哪个子控制器来决定是否隐藏状态栏

如果你遇到 UINavigationBar 的相关问题,请访问 HBDNavigationBar

Installation

HBDStatusBar is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'HBDStatusBar'

Author

[email protected]

License

HBDStatusBar is available under the MIT license. See the LICENSE file for more info.

hbdstatusbar's People

Contributors

listenzz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.