Latest 0.0.1
Homepage https://github.com/SCKaito/SCOptionPage
License MIT
Platforms ios 8.0
Authors

SCOptionPage(swift)

类似于今日头条,斗鱼TV 选项卡界面(界面可以根据需求自行定制, 是否文字放大,是否滚动,是否有背景,颜色,大小都可根据需求自定制)

样式

UI样式1UI样式2样式3

代码

//let titles = ["推荐", "手游玩法大全", "娱乐手", "游戏游戏", "趣玩", "游戏游戏", "趣玩"]
let titles = ["推荐", "手游", "娱乐", "游戏", "趣玩"]
let style = SCOptionPageStyle()
style.titleViewHeight = 44
style.isScrollEnable = false
style.isTitleScale = false
style.isShowCoverView = false

var childVcs = [UIViewController]()
    for _ in 0..<titles.count {
    let vc = UIViewController()
    vc.view.backgroundColor = UIColor.randomColor()
    childVcs.append(vc)
}

let pageViewFrame = CGRect(x: 0, y: 64, width: view.bounds.width, height: view.bounds.height - 64 - 49)
let pageView = SCOpitonPageView(frame: pageViewFrame, titles: titles, titleStyle: style, childVcs: childVcs, parentVc: self)
pageView.delegate = self
view.addSubview(pageView)

添加代理来监听点击和滚动到第几个界面

extension ViewController: SCOptionPageDelegate {

    //选项卡点击
    func optionPageClick(optionPage : SCOpitonPageView, index : Int){

        print(optionPage)
        print(index)
    }
    //滚动类容视图
    func optionPageScroll(optionPage : SCOpitonPageView, index : Int){
        print(optionPage)
        print(index)
    }
}

Latest podspec

{
    "name": "SCOptionPage",
    "version": "0.0.1",
    "summary": "A Modul for OptionPage",
    "swift_version": "4.0",
    "description": "u7c7bu4f3cu4e8eu4ecau65e5u5934u6761,u6597u9c7cTV u9009u9879u5361u754cu9762(u754cu9762u53efu4ee5u6839u636eu9700u6c42u81eau884cu5b9au5236, u662fu5426u6587u5b57u653eu5927,u662fu5426u6edau52a8,u662fu5426u6709u80ccu666f,u989cu8272,u5927u5c0fu90fdu53efu6839u636eu9700u6c42u81eau5b9au5236)",
    "homepage": "https://github.com/SCKaito/SCOptionPage",
    "license": "MIT",
    "authors": {
        "kaito": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/SCKaito/SCOptionPage.git",
        "tag": "0.0.1"
    },
    "source_files": "SCOptionPage/**/*"
}

Pin It on Pinterest

Share This