Giter Site home page Giter Site logo

xhsegmentcontroller's Introduction

XHSegmentController

image
这是一款分段选择控制器,分XHSegmentViewControllerXHSegmentControl两部分
XHSegmentViewController通过添加子Controller实现,可以通过左右滑动页面来滑动选择器,适合用自定义segment来管理不同的页面
当然为了做到控件尽量轻量级,你也可以作为一个控件,单独使用XHSegmentControl ##XHSegmentViewController XHSegmentViewController使用如下,自定义ViewController并继承XHSegmentViewController,设置viewControllers属性
要点:要设置子ViewController的title,否则字体显示不出

     ViewController *vc1 = [[ViewController alloc] init];
     vc1.title = @"男装";
     ViewController *vc2 = [[ViewController alloc] init];
     vc2.title = @"女装";
     ViewController *vc3 = [[ViewController alloc] init];
     vc3.title = @"童装";
     self.viewControllers = @[vc1, vc2, vc3];

##XHSegmentControl XHSegmentControl是一个UIView类型的控件,可以设置控件背景色,添加底部高亮线,并设置标题字体和颜色等
有两种模式可通过segmentType属性来设置
分别是:

typedef NS_ENUM(NSInteger, XHSegmentType)
{
    XHSegmentTypeFilled = 0,    //  充满屏幕高度
    XHSegmentTypeFit,           //  适应文字大小
    XHSegmentTypeCircle         //  循环(待做)
};

@protocol XHSegmentControlDelegate <NSObject>
- (void)xhSegmentSelectAtIndex:(NSInteger)index animation:(BOOL)animation;
@end

XHSegmentControlDelegatesegmentControl的代理,包含方法可用来接受segment选择事件

xhsegmentcontroller's People

Contributors

zhuyunfeng1224 avatar

Watchers

 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.