首先导入pageView文件
然后在相应的位置上写
/// 标题
let titles = ["XX","XX", "XX", "XX", "XX"]
//样式
let style = YCTitleStyle()
//可以滚动
style.isScrollEnable = false
// 所以的子控制器
var childVcs = [UIViewController]()
for var k in 0..<titles.count {
var vc = UIViewController()
if(0 == k){
vc = OneViewController()
}
vc.view.backgroundColor = UIColor.white
childVcs.append(vc)
}
// pageView的frame
let pageFrame = CGRect(x: 0, y: 60, width: view.bounds.width, height: view.bounds.height - 64)
// 创建YCPageView,并且添加到控制器的view中
let pageView = YCPageView(frame: pageFrame, titles: titles, childVcs: childVcs, parentVc: self, style : style)
view.addSubview(pageView)
网友评论