TabPageView
iOS 中 TabPageView 的 Swift 版本
示例
要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install
要求
- iOS 9.0+
- Xcode 9+
- Swift 4.0+
通信
- 如果您 需要帮助,请使用 Stack Overflow。 (标签 'sftabpage')
- 如果您想 提出一般问题,请使用 Stack Overflow。
- 如果您 发现了一个错误,请打开一个问题。
- 如果您 有功能请求,请打开一个问题。
- 如果您 想要贡献,提交一个拉取请求。
安装
CocoaPods
TabPageView 可通过 CocoaPods 获得。CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它
$ gem install cocoapods
要安装它,只需将以下行添加到您的 Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'TabPageView'
end
Then, run the following command:
```bash
$ pod install
手动
如果您不希望使用上述任何依赖管理器,您可以将 TabPageView 手动集成到您的项目中。
作者
ShenZhengFang, [email protected]
用法
import UIKit
import TabPageView
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// let titles = ["iPhone", "iOS", "KobeBryant", "Beautiful Girl", "UtoVR", "brianbryant", "JustinBieber", "中国", "Taylor Swift"]
let titles = ["我的", "你的", "她的"]
var childVCs = [UIViewController]()
for _ in 0..<titles.count {
let vc = UIViewController()
vc.view.backgroundColor = UIColor.randomColor()
childVCs.append(vc)
}
let style = PageStyle()
style.isScrollEnable = false
let tabPageView = TabPageView(frame: self.view.bounds, style: style, titles: titles, childVCs: childVCs, parentVC: self)
tabPageView.backgroundColor = UIColor.orange
view.addSubview(tabPageView)
view.backgroundColor = UIColor.red
}
}
许可
TabPageView 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。