Git Product home page Git Product logo

zjpslidesegment's Introduction

ZJPSlideSegment

ZJPSlideSegment 是一款可以根据大部分需求自定义的分段选择器空间,现支持的样式如下:

ZJPSlideSegment1

安装

手动安装

使用方法,手动下载ZJPSlideSegment.hZJPSlideSegment.m文件添加到项目中即可。

CocoaPod安装

pod ZJPSlideSegmen

使用方法

Objective-C:

#import "ZJPSlideSegmen.h"

self.segmentBackColor = [[ZJPSlideSegment alloc]initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 40) Style:ZJPSegmentBackColorStyle];
self.segmentBackColor.backgroundColor = [UIColor lightGrayColor];
[self.segmentBackColor setItems:@[@"菜单1",@"测试菜单1",@"菜单2",@"测试菜单2"]];
[self.view addSubview:self.segmentBackColor];

[self.segmentBackColor itemClicked:^(NSString *itemTitle, NSInteger index) {
        NSLog(@"%@被选中,下标为%ld",itemTitle,(long)index);
    }];

其他属性:

//选中颜色,默认为红色
@property (nonatomic,strong) UIColor *selectedItemColor;
//item未选中颜色,默认为黑色
@property (nonatomic,strong) UIColor *itemsDefualtColor;
//item字体大小,默认为14
@property (nonatomic,assign) CGFloat itemsFontSize;
//item之间的距离,默认为8
@property (nonatomic,assign) CGFloat itemesOfMargin;
//初始选中项,默认从第一个开始(下标为0)
@property (nonatomic,assign) NSInteger defualtSelectedIndexOfItem;

运行环境

  • iOS8 +

zjpslidesegment's People

Contributors

chou-jp777 avatar

Stargazers

 avatar  avatar  avatar Anthony avatar Zenon avatar

Watchers

 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.