Latest 0.1.1
Homepage https://github.com/zblbolin/LBSegmentBar
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

使用cocoapods:

pod 'LBTools'

导入头文件

#import 'LBSebmentBarVC.h'

把添加的LBSebmentBarVC控制器作为你创建的控制的子控制器:


self.segmentBarVC.segmentBar.frame = CGRectMake(0, 0, 300, 35);
self.segmentBarVC.segmentBar.backgroundColor = [UIColor greenColor];
self.navigationItem.titleView = self.segmentBarVC.segmentBar;

self.segmentBarVC.view.frame = self.view.bounds;
[self.view addSubview:self.segmentBarVC.view];

NSArray *items = @[@"专辑", @"声音", @"下载中"];

// 添加几个自控制器
// 在contentView, 展示子控制器的视图内容

UIViewController *vc1 = [UIViewController new];
vc1.view.backgroundColor = [UIColor redColor];

UIViewController *vc2 = [UIViewController new];
vc2.view.backgroundColor = [UIColor greenColor];

UIViewController *vc3 = [UIViewController new];
vc3.view.backgroundColor = [UIColor yellowColor];

[self.segmentBarVC setUpWithItems:items childViewControllers:@[vc1, vc2, vc3]];

//        XMGSegmentBarConfig *config = [XMGSegmentBarConfig defaultConfig];
//        config.itemFont = ;
//
//        self.segmentBarVC.segmentBar.config = config;

//添加选项卡的基本设置
[self.segmentBarVC.segmentBar updateWithConfig:^(LBSegmentBarConfig *config) {

//            config.segmentBarBackColor = [UIColor cyanColor];
//            config.itemNormalColor = [UIColor brownColor];
//            config.itemSelectColor = [UIColor yellowColor];
//            config.itemSC([UIColor brownColor]).itemNC([UIColor yellowColor]);

config.itemNC([UIColor redColor]).itemSC([UIColor orangeColor]).indicatorEW(10);
//            config.itemFont = [UIFont fontWithName:@"Zapfino" size:10];
//
//            config.indicatorHeight = 5;
//            config.indicatorColor = [UIColor blueColor];
//            config.indicatorExtraW = 0;

}];

或者是继承LBSebmentBarVC类,重写方法:

-(void)setUpWithItems:(NSArray <NSString *>*)items childViewControllers:(NSArray <UIViewController *>*)childViewControllers;

效果图

效果图

作者简书地址

Author

作者:卟师, [email protected]

License

LBTools is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "LBTools",
    "version": "0.1.1",
    "summary": "u81eau5df1u5c01u88c5u7684u63a7u4ef6",
    "description": "LBTools.u81eau5df1u5c01u88c5u7684u63a7u4ef6u548cu4e00u4e9bu5de5u5177u7c7b",
    "homepage": "https://github.com/zblbolin/LBSegmentBar",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "u535fu5e08"
    },
    "source": {
        "git": "https://github.com/zblbolin/LBSegmentBar.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "subspecs": [
        {
            "name": "LBSegmentBar",
            "source_files": "LBTools/Classes/Base/LBSegmentBar/*"
        },
        {
            "name": "LBDownLoader",
            "source_files": "LBTools/Classes/Base/LBDownLoader/*"
        }
    ]
}

Pin It on Pinterest

Share This