Coder Social home page Coder Social logo

ypnavtabbarcontroller's Introduction

YPNavTabBarController

##这是一款自定义滑块分段选择控制器

  • An easy way to use Segment selection controller
  • 用法简单的滑块分段选择控制器:两行代码就可集成 (效果展示)

Contents

如何使用YPNavTabBarController

  • 手动导入:
    • YPNavTabBarController文件夹中的所有文件拽入项目中
    • 导入主头文件:#import "YPNavTabBarController.h"

YPNavTabBarController.h

@interface YPNavTabBarController : UIViewController

/** 子控制器 */
@property (nonatomic, strong) NSArray *subViewControllers;

/** 选项条顶端距离父视图顶端的距离 */
@property (nonatomic, assign) CGFloat navTabBar_Y;

/** 内容视图的高度 */
@property (nonatomic, assign) CGFloat contentViewH;

/** 设置风格 */
@property (nonatomic, assign) YPNavTabBarType navTabBar_type;

/** 设置选项排列风格 */
@property (nonatomic, assign) YPNavTabBarStyle navTabBar_style;

/** 设置选项卡的背景颜色 */
@property (nonatomic, strong) UIColor *navTabBar_color;

/** 选项条横条的颜色 */
@property (nonatomic, strong) UIColor *navTabBarLine_color;

/** 选项标题普通状态文字的颜色 */
@property (nonatomic, strong) UIColor *navTabBar_normalTitle_color;

/** 选项标题选中状态文字的颜色 */
@property (nonatomic, strong) UIColor *navTabBar_selectedTitle_color;

/** 索引 */
@property (nonatomic, assign) NSInteger currentIndex;

- (instancetype)initWithParentViewController:(UIViewController *)parentViewController;

/**
 *  此方法已过期. 请使用'initWithParentViewController:'
 */
- (void)addParentController:(UIViewController *)viewController __deprecated_msg("此方法已过期. 请使用'initWithParentViewController:'");


@end

@interface UIViewController (YPNavTabBarControllerItem)

@property (nonatomic, strong, readonly) YPNavTabBarController *navTabBarController;

@end

默认快速集成

(默认)

    OneViewController *oneVc = [[OneViewController alloc] init];
    oneVc.title = @"娱乐";
    TwoViewController *twoVc = [[TwoViewController alloc] init];
    twoVc.title = @"体育";
    ThreeViewController *threeVc = [[ThreeViewController alloc] init];
    threeVc.title = @"北京";
    FourViewController *fourVc = [[FourViewController alloc] init];
    fourVc.title = @"国际新闻";
    FiveViewController *fiveVc = [[FiveViewController alloc] init];
    fiveVc.title = @"测试模块1";
    SixViewController *sixVc = [[SixViewController alloc] init];
    sixVc.title = @"测试模块22";
    
    YPNavTabBarController *navTabBarController = [[YPNavTabBarController alloc] initWithParentViewController:self];
    navTabBarController.subViewControllers = @[oneVc, twoVc, threeVc, fourVc , fiveVc,sixVc];
    
    /**
     *  以下内容都是可选参数
     */
     
    // 设置选项的位置(垂直方向)
    navTabBarController.navTabBar_Y = 20;   // 默认为0
    // 设置默认选中索引(默认选中第一页)
    // navTabBarController.currentIndex = 0;
    
    // 设置样式
    // navTabBarController.navTabBar_type = YPNavTabBarTypeEllipse;
    
    // 设置内容视图的高度
    // navTabBarController.contentViewH = 100; // 默认填充
    // 设置选项条的背景颜色
    // navTabBarController.navTabBar_color = [UIColor redColor];
    // 设置选项条的导航条颜色
    // navTabBarController.navTabBarLine_color = [UIColor yellowColor];
    // 设置未被选中时的标题字体颜色
    // navTabBarController.navTabBar_normalTitle_color = [UIColor purpleColor];
    // 设置选中时的标题字体颜色
    // navTabBarController.navTabBar_selectedTitle_color = [UIColor orangeColor];
    // navTabBarController.navTabBar_style = YPNavTabBarStyleCenter;

ypnavtabbarcontroller's People

Contributors

michaelhuyp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  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.