Git Product home page Git Product logo

xhnavbar's Introduction

XHNavBar

  • 快速创建navigationBar,支持系统navigationBar及自定义navigationBar

使用方法

1.栗子

  • 自定义navigationBar-快速设置
    //1.初始化navigationBar + 设置标题
    [self cus_initNavBarAndSetTitle:@"首页"];
    //1.初始化navigationBar + 设置标题 + 自定义返回事件 (两方法二选一)
    [self cus_initNavBarAndSetTitle:@"首页" backAction:@selector(backAction)];
    
    //2.设置rightBarButtonItem
    //-文字类型
    [self cus_setNavBarRightButtonWithTitle:@"保存" action:@selector(saveAction)];
    //-图片类型
    //[selector cus_setNavBarRightButtonWithImageName:@"xh_navbar_back" action:@selector(saveAction)];
  • 使用系统navigationBar-快速设置
    //1.初始化navigationBar + 设置标题
    [self cus_initNavBarAndSetTitle:@"首页"];
    
    //2.设置rightBarButtonItem
    //-文字类型
    [self cus_setNavBarRightButtonWithTitle:@"保存" action:@selector(saveAction)];
    //-图片类型
    //[selector cus_setNavBarRightButtonWithImageName:@"xh_navbar_back" action:@selector(saveAction)];

2.文字颜色,字体大小等请在XHNavBar.m 上面宏定义中修改

3.相关API

#pragma mark-使用系统 navigationBar

/**
 *   系统navbar-初始化+设置标题(此方法,包含初始化和设置标题 2步操作)
 *
 *  @param title 标题
 */
-(void )sys_initNavBarAndSetTitle:(NSString *)title;

/**
 *   系统navbar-设置rightButton with title
 *
 *  @param name     title
 *  @param selecter 事件
 *
 *  @return Button
 */
-(UIButton *)sys_setNavBarRightButtonWithTitle:(NSString *)name action:(SEL)selecter;

/**
 *  系统navbar-设置rightButton with imageName
 *
 *  @param name     图片名
 *  @param selecter 事件
 *
 *  @return Button
 */
-(UIButton *)sys_setNavBarRightButtonWithImageName:(NSString *)name action:(SEL)selecter;

#pragma mark-自定义navigationBar

/**
 *  自定义navbar-初始化+设置标题
 *
 *  @param title 标题
 *
 *  @return 标题Label
 */
-(UILabel  *)cus_initNavBarAndSetTitle:(NSString *)title;

/**
 *  自定义navbar-初始化+设置标题+自定义返回事件
 *
 *  @param title    标题
 *  @param selecter 返回事件
 *
 *  @return 标题Label
 */
-(UILabel *)cus_initNavBarAndSetTitle:(NSString *)title backAction:(SEL)selecter;

/**
 *  自定义navbar-设置rightButton(文字类型)
 *
 *  @param name     title
 *  @param selecter 事件
 *
 *  @return Button
 */
-(UIButton *)cus_setNavBarRightButtonWithTitle:(NSString *)name action:(SEL)selecter;
/**
 *  自定义navbar-设置rightButton(图片类型)
 *
 *  @param name     图片名
 *  @param selecter 事件
 *
 *  @return Button
 */
-(UIButton *)cus_setNavBarRightButtonWithImageName:(NSString *)name action:(SEL)selecter;

安装

手动添加:

  • 1.将 XHNavBar 文件夹添加到工程目录中
  • 2.导入 XHNavBar.h

CocoaPods:

  • 1.在 Podfile 中添加 pod 'XHNavBar'
  • 2.执行 pod install 或 pod update
  • 3.导入 XHNavBar.h

系统要求

  • 该项目最低支持 iOS 7.0 和 Xcode 7.0

许可证

XHNavBar 使用 MIT 许可证,详情见 LICENSE 文件

xhnavbar's People

Contributors

coderzhuxh avatar

Watchers

James Cloos avatar 1099779883 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.