最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

[已解决]swift tab 分页 控件 库

iOS crifan 1632浏览 0评论

alikaragoz/AKSegmentedControl: Fully customizable Segmented Control for iOS

ios segment lib

swift segmented control github

sima-11/SMSegmentView: Custom segmentedControl for iOS written in Swift. Supports vertical layout. Support both image and text. Highly customisable.

[总结]

优先:

HighBay/PageMenu: A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)

2.

HeshamMegid/HMSegmentedControl: A drop-in replacement for UISegmentedControl mimicking the style of the segmented control used in Google Currents and various other Google products.

也不错

3.

kitasuke/PagingMenuController: Paging view controller with customizable menu in Swift

yemeksepeti/YSSegmentedControl: Android style segmented control written in swift. Fully customisable.

maxep/MXSegmentedPager: Segmented pager view with Parallax header

[总结]

最后是去用了:

HighBay/PageMenu: A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram)

还是很好用的。

主要代码:

CustomerTrafficReportViewController.swift

//
//  CustomerTrafficReportViewController.swift
//  SalesApp
//
//  Created by licrifan on 16/7/1.
//  Copyright © 2016年 licrifan. All rights reserved.
//
import UIKit
import PageMenu
let SourceTrafficRowTitleList:[String] = [
    "顾问客户来源",
    "流量",
    "留档客户",
    "未留档客户",
    "订单客户数",
    "成交客户数",
    "留档率",
    "订单率",
    "成交率",
]
let CustomerTrafficItemHeight:CGFloat = 30
//let CustomerTrafficItemSize = CGSize(width: ScreenWidth/CGFloat(VisibleColumnNum), height: CustomerTrafficItemHeight)
let CustomerTrafficItemSize = CGSize(width: 80, height: CustomerTrafficItemHeight)
let CustomerTrafficItemSizeFirstColumn = CGSize(width: 100, height: CustomerTrafficItemHeight)
class CustomerTrafficReportViewController: UIViewController, CAPSPageMenuDelegate {
    var pageMenu:CAPSPageMenu!
    var pageMenuVCArr:[UIViewController]
    init(){
        self.pageMenuVCArr = [UIViewController]()
        super.init(nibName: nil, bundle: nil)
        self.title = "客户流量报表"
        let channelSourceTrafficVC = ChannelSourceTrafficReportViewController()
        let dataSourceTrafficVC = DataSourceTrafficReportViewController()
        self.pageMenuVCArr.append(channelSourceTrafficVC)
        self.pageMenuVCArr.append(dataSourceTrafficVC)
        let pageMenuFrame = CGRectMake(0, 0, ScreenWidth, ScreenHeight)
        let parameters: [CAPSPageMenuOption] = [
            .SelectionIndicatorHeight(2),
            .MenuItemSeparatorWidth(1),
            .MenuItemSeparatorPercentageHeight(1.0),
            .MenuItemSeparatorColor(CommonLineColorLightGray),
            .UseMenuLikeSegmentedControl(true),
            .ScrollMenuBackgroundColor(UIColor.whiteColor()),
            .ViewBackgroundColor(UIColor.whiteColor()),
            .SelectionIndicatorColor(CommonSelectedBackgroundColorRed),
            .SelectedMenuItemLabelColor(CommonSelectedBackgroundColorRed),
            .UnselectedMenuItemLabelColor(CommonTextColorBlack)
        ]
        self.pageMenu = CAPSPageMenu(viewControllers: self.pageMenuVCArr, frame: pageMenuFrame, pageMenuOptions: parameters)
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    /*************************************************************************
     * View Controller Functions
     *************************************************************************/
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = AppBackgoundColor
        self.pageMenu.delegate = self
        self.view.addSubview(self.pageMenu.view)
    }
    /*************************************************************************
     * CAPSPageMenuDelegate Functions
     *************************************************************************/
    func willMoveToPage(vc: UIViewController, index: Int){
        gLog.verbose("vc=\(vc), index=\(index)")
    }
    func didMoveToPage(vc: UIViewController, index: Int){
        gLog.verbose("vc=\(vc), index=\(index)")
    }
}

ChannelSourceTrafficReportViewController.swift

//
//  ChannelSourceTrafficReportViewController.swift
//  SalesApp
//
//  Created by licrifan on 16/7/1.
//  Copyright © 2016年 licrifan. All rights reserved.
//
import UIKit
import Alamofire
import SwiftyJSON
class ChannelSourceTrafficReportViewController: UIViewController {
    init(){
        super.init(nibName: nil, bundle: nil)
        self.title = "客户来源"
   }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    /*************************************************************************
     * View Controller Functions
     *************************************************************************/
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = AppBackgoundColor
        self.view.addSubview(self.gridView)
    }
……
}

DataSourceTrafficReportViewController.swift

//
//  DataSourceTrafficReportViewController.swift
//  SalesApp
//
//  Created by licrifan on 16/7/1.
//  Copyright © 2016年 licrifan. All rights reserved.
//
import UIKit
import Alamofire
import SwiftyJSON
class DataSourceTrafficReportViewController: UIViewController {
    ……
    init(){
    ……
        super.init(nibName: nil, bundle: nil)
    ……
        self.title = "数据来源"
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    /*************************************************************************
     * View Controller Functions
     *************************************************************************/
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = AppBackgoundColor
        self.view.addSubview(self.gridView)
    }
    ……
}

效果如下:

左右移动切换的时候:

转载请注明:在路上 » [已解决]swift tab 分页 控件 库

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
60 queries in 0.220 seconds, using 18.80MB memory