Git Product home page Git Product logo

jhnavigation's Introduction

JHNavigation

方便路由使用的iOS导航控制方式

为什么要开发这个库? 由于多人合作开发,每个人只关注自身页面的样式实现。但由于页面越来越多,且大部分页面都支持了路由,导致页面间的跳转关系将会非常复杂且不可预知,所以主要是为了解决这个问题。

核心**: 使用者只需要关心自身页面的样式即可

本库采用为UIViewController和UINavigationController添加category的方式实现。直接导入即可使用。

UIViewController+JHNavigation.hUINavigationController+JHNavigation.h为主要使用类

另:JHNavigation会在页面跳转时记录当前页面状态(导航条的显示,屏幕旋转方向),在回退(pop)时仍保持原本状态。

导航条的显示相关

例一:

A页面带导航条, B页面不带导航条, C页面带导航条。 当三个页面相互跳转时,需要在viewWillAppear和viewWillDisAppear里设置设置导航条的显示和隐藏.

使用JHNavigation后,只需要在viewDidLoad时设置当前页面的导航条显示状态即可,页面间的跳转无需管理。

A页面
- (void)viewDidLoad {
    self.jh_navigationBarStatus = JHNavigationBarStatusDefault;
}

B页面
- (void)viewDidLoad {
    self.jh_navigationBarStatus = JHNavigationBarStatusHidden;
}

C页面
- (void)viewDidLoad {
    self.jh_navigationBarStatus = JHNavigationBarStatusDefault;
}

屏幕旋转相关

例二:

A页面为竖屏不可旋转 B页面为横屏可以旋转

同样的思路,只需要给需要展示的页面设置需要展示的状态即可。

A页面
- (void)viewDidLoad {
    self.jh_preferredInterfaceOrientationForPresentation = JHInterfaceOrientationPortrait;
    self.jh_shouldAutorotate = JHAutorotateStatusDisable;
}

B页面
- (void)viewDidLoad {
    self.jh_shouldAutorotate = JHAutorotateStatusEnable;
    self.jh_preferredInterfaceOrientationForPresentation = JHInterfaceOrientationLandscapeRight;
}

转场方式

更多操作

详见Demo

jhnavigation's People

Contributors

jinhuilu avatar

Stargazers

George Zhao | 赵毅 avatar  avatar  avatar  avatar  avatar  avatar shan avatar

Forkers

zhaoyichina

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.