• Stars
    star
    1,580
  • Rank 29,620 (Top 0.6 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 8 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A powerful and easy to use segment view 【QQ、淘宝、微博、腾讯、网易新闻、今日头条等标题滚动视图】

SGPagingView

前言

结构图

效果图

Installation

  • CocoaPods 导入 pod 'SGPagingView', '~> 2.1.0'

代码介绍

  • 初始化方法
// 配置类
let configure = SGPagingTitleViewConfigure()

// 标题视图
let pagingTitleView = SGPagingTitleView(frame: frame, titles: titles, configure: configure)
pagingTitleView.delegate = self
view.addSubview(pagingTitleView)

// 内容视图
let pagingContentView = SGPagingContentScrollView(frame: frame, parentVC: self, childVCs: childVCs)
pagingContentView.delegate = self
view.addSubview(pagingContentView)
  • SGPagingTitleView 代理方法
func pagingTitleView(titleView: SGPagingTitleView, index: Int) {
    pagingContentView.setPagingContentView(index: index)
}
  • SGPagingContentView 代理方法
func pagingContentView(contentView: SGPagingContentView, progress: CGFloat, currentIndex: Int, targetIndex: Int) {
    pagingTitleView.setPagingTitleView(progress: progress, currentIndex: currentIndex, targetIndex: targetIndex)
}

Requirements

  • iOS 10.0 +
  • Swift 5.0 +

Concluding remarks