iOS平台轻量级的PageView组件,其中TitleBar拥有30多种UI样式
升级修改模块public权限
override func viewDidLoad() {
super.viewDidLoad()
let pageView = WHC_PageView()
pageView.delegate = self
self.view.addSubview(pageView)
pageView.whc_Left(0)
.whc_Top(0)
.whc_Right(0)
.whc_Bottom(0)
let layoutParam = WHC_PageViewLayoutParam()
layoutParam.titles = ["新闻","外汇","黄金","原油","白银","股票","现货"]
layoutParam.itemWidth = 80 /***如果标题很多一屏放不下需要设定每个标题的固定宽度否则可以忽略***/
layoutParam.selectedTextColor = UIColor.orange
layoutParam.normalBackgorundColor = UIColor.white
layoutParam.normalTextColor = UIColor.black
layoutParam.selectedBackgorundColor = UIColor.gary
pageView.layoutIfNeeded()
pageView.layoutParam = layoutParam
}
//MARK: - WHC_PageViewDelegate -
func whcPageViewStartLoadingViews() -> [UIView]! {
return views
}
func whcPageView(pageView: WHC_PageView, willUpdateView view: UIView, index: Int) {
print("更新当前视图")
}
override func viewDidLoad() {
super.viewDidLoad()
let bottomBar = WHC_TitlesBar()
self.view.addSubview(bottomBar)
bottomBar.whc_Left(0)
.whc_Right(0)
.whc_BaseLine(0)
.whc_Height(50)
/// 设置底部bar的样式
let layoutParam = WHC_TitlesBarLayoutParam()
layoutParam.titles = ["样式","样式二","Android","iOS"]
layoutParam.images = images
layoutParam.selectedImages = selectedImages
layoutParam.bottomLineHeight = WHC_TitlesBarLayoutParam.kNotCreateLine
layoutParam.hasBottomCursor = false
layoutParam.topLineHeight = 0.5
layoutParam.normalFont = UIFont.systemFont(ofSize: 10)
layoutParam.selectedFont = UIFont.systemFont(ofSize: 10)
layoutParam.selectedTextColor = UIColor.gray
layoutParam.itemTextImageMargin = 3
layoutParam.defaultSelectIndex = 0
layoutParam.itemImageSize = CGSize(width: 25, height: 25)
layoutParam.itemLayoutStyle = .Image_Top_Text_Bottom
bottomBar.layoutIfNeeded()
bottomBar.layoutParam = layoutParam
/// 设置点击回调
bottomBar.clickButtonCallback = {(index: Int) in
}
}
All source code is licensed under the MIT License.