SegmentPageView
这是一个分段标题视图和页面视图菜单。
IMSegmentPageView 是一个 Swift 库,它提供可定制的分段标题视图和页面视图菜单。
要求
- iOS 9.0+
- Swift 4.2+
安装
将类文件夹直接拖放到您的 Xcode 项目中。
Cocoapods
使用在您的 Podfile
中添加 pod 'IMSegmentPageView'
并运行 pod install
。同时,请将 use_frameworks!
添加到 Podfile
中。
use_frameworks!
pod 'IMSegmentPageView'
Carthage
使用将github "iMazy/IMSegmentPageView"
添加到你的Cartfile
中并运行carthage update
。如果你对Carthage不熟悉,可以查看他们的入门部分。
github "iMazy/IMSegmentPageView"
IMSegmentPageView 使用方法
导入 IMSegmentPageView
导入IMSegmentPageView
,然后在viewDidLoad以外的某些函数中使用以下代码。
添加分区标题视图
let property = IMSegmentTitleProperty()
property.indicatorHeight = 3
property.indicatorType = .width
property.isLeft = false
property.showBottomLine = true
let titles = ["首页", "电影", "影院", "演出", "MV", "榜单", "热点", "商城"]
let titleFrame = CGRect.zero # set what you need
let titleView = IMSegmentTitleView(frame: titleFrame, titles: titles, property: property)
titleView.delegate = self # if need, you should implement delegate methods
view.addSubview(titleView)
添加带有控件的PageView视图
var childVCs: [UIViewController] = [] // viewControllers
let contentFrame = CGRect.zero # set what you need
let pageView = IMPageContentView(Frame: contentFrame, childVCs: childVCs, parentVC: self)
pageView.delegate = self # if need, you should implement delegate methods
view.addSubview(pageView!)
作者
iMazy
http://imazy.cn
反馈
你可以通过电子邮件[email protected]给我反馈
许可证
XMAlertSheetController 在MIT许可证下发布。
有关详细信息,请参阅LICENSE文件。