Latest 0.0.1
Homepage https://github.com/Guanzhangpeng/ZPSegmentBar
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

一款模仿今日头条或者是网易新闻 NavigationBar 的框架,使用起来非常简单,只需要一句代码就可以集成该框架

//创建ZPSegmentBarView
let segmentView = ZPSegmentBarView(frame: frame, titles: titles, style: style, childVcs: childVcs, parentVc: self)

view.addSubview(segmentView)

HOW TO USE

scroll.gif
scroll2.gif

集成该框架非常的方便,我们只需要调用let segmentView = ZPSegmentBarView(frame: frame, titles: titles, style: style, childVcs: childVcs, parentVc: self)即可创建该View,然后传入相关的参数即可,例如下面的小demo:

import UIKit
import ZPSegmentBar  //导入框架名称
class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        automaticallyAdjustsScrollViewInsets=false

        let frame=CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height)

        //1.0 设置显示的title
        let titles = ["推荐321","热点3","直播6666","视频","阳光视频","社会热点","娱乐","科技","汽车"]

        //2.0 设置自己喜欢的样式,该结构体提供了多种样式供使用
        var style = ZPStyle()
        style.isShowCover = true    //显示遮盖
        style.isShowBottomLine=true //显示BottomLine
        style.isNeedScale=true      //文字缩放

        //3.0 设置控制器
        var childVcs = [UIViewController]()
        for _ in titles {
            let vc = UIViewController()
            vc.view.backgroundColor=UIColor(red: CGFloat(arc4random_uniform(256))/255.0, green: CGFloat(arc4random_uniform(256))/255.0, blue: CGFloat(arc4random_uniform(256))/255.0, alpha: 1.0)
            childVcs.append(vc)
        }

        //4.0 创建ZPSegmentBarView
        let segmentView = ZPSegmentBarView(frame: frame, titles: titles, style: style, childVcs: childVcs, parentVc: self)

        view.addSubview(segmentView)
    }

Installation

ZPSegmentBar is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "ZPSegmentBar"

Author

简书连接

gzp, [email protected]

License

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

Latest podspec

{
    "name": "ZPSegmentBar",
    "version": "0.0.1",
    "summary": "ZPSegmentBar",
    "description": "TODO: u6a21u4effu4ecau65e5u5934u6761 u7f51u6613u65b0u95fbu7b49u7684NavigationBaru6548u679c",
    "homepage": "https://github.com/Guanzhangpeng/ZPSegmentBar",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "gzp": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Guanzhangpeng/ZPSegmentBar.git",
        "tag": "0.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ZPSegmentBar/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This