轻量级分页 PageView 组件标题栏支持自定义
cqja6130
8年前
<h2><strong>WHC_PageViewKit</strong></h2> <h2><strong>简介</strong></h2> <ul> <li><strong>高效</strong> : 预加载机制</li> <li><strong>方便</strong> : 只需要设置简单参数即可构建炫酷的TitleBar和PageView</li> <li><strong>动画</strong> : 支持翻页TitleBar炫酷动画效果</li> <li><strong>优势</strong> : TitleBar模块和PageView模块可以单独使用</li> <li><strong>强大</strong> : TitleBar支持30多种UI样式</li> <li><strong>咨询</strong> : 712641411</li> <li><strong>作者</strong> : 吴海超</li> </ul> <h2><strong>集成</strong></h2> <ul> <li>使用CocoaPods:</li> <li>pod 'WHC_PageViewKit', '~> 1.0.5'</li> <li>手工集成:</li> <li>导入文件夹WHC_PageViewKit</li> </ul> <h2><strong>使用第三方库</strong></h2> <ul> <li>超好用自动布局库WHC_AutoLayoutKit</li> </ul> <h2><strong>使用演示</strong></h2> <p style="text-align:center"><img src="https://simg.open-open.com/show/315fee69f9c75f0437432c25e588555d.gif"> <img src="https://simg.open-open.com/show/d7b324bb1bd127a9059c5370abfc5f82.jpg"> <img src="https://simg.open-open.com/show/39261f88d0b748d8343740ab65657f37.jpg"> <img src="https://simg.open-open.com/show/5da9f8551ea31d8cae85433a863165f5.jpg"></p> <h2><strong>要求</strong></h2> <ul> <li>iOS 8.0 or later</li> <li>Xcode 8.0 or later</li> </ul> <h2><strong>用法</strong></h2> <ul> <li>创建PageView</li> </ul> <pre> <code class="language-java">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("更新当前视图") }</code></pre> <ul> <li>单独创建TitleBar</li> </ul> <pre> <code class="language-java">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 } }</code></pre> <h2><strong>期待</strong></h2> <ul> <li>如果您在使用过程中有任何问题,欢迎issue me! 很乐意为您解答任何相关问题!</li> <li>与其给我点star,不如向我狠狠地抛来一个BUG!</li> <li>如果您想要更多的接口来自定义或者建议/意见,欢迎issue me!我会根据大家的需求提供更多的接口!</li> </ul> <h2><strong>Licenses</strong></h2> <p>All source code is licensed under the MIT License.</p> <p> </p> <p> </p>