Code Monkey home page Code Monkey logo

whc_pageviewkit's Introduction

WHC_PageViewKit

Build Status Pod Version Pod Platform Pod License

简介

  • 高效: 预加载机制
  • 方便: 只需要设置简单参数即可构建炫酷的TitleBar和PageView
  • 动画: 支持翻页TitleBar炫酷动画效果
  • 优势: TitleBar模块和PageView模块可以单独使用
  • 强大: TitleBar支持多种UI样式
  • 咨询: 712641411
  • 作者: 吴海超

NOTE

升级修改模块public权限

集成

  • 使用CocoaPods:
  • pod 'WHC_PageViewKit', '~> 1.0.5'
  • 手工集成:
  • 导入文件夹WHC_PageViewKit

使用第三方库

使用演示

要求

  • iOS 8.0 or later
  • Xcode 8.0 or later

用法

  • 创建PageView
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("更新当前视图")
}
  • 单独创建TitleBar
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

    }
}

期待

  • 如果您在使用过程中有任何问题,欢迎issue me! 很乐意为您解答任何相关问题!
  • 与其给我点star,不如向我狠狠地抛来一个BUG!
  • 如果您想要更多的接口来自定义或者建议/意见,欢迎issue me!我会根据大家的需求提供更多的接口!

Licenses

All source code is licensed under the MIT License.

whc_pageviewkit's People

Contributors

netyouli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

whc_pageviewkit's Issues

itemWidth设置为固定,且items的宽度不足占满一屏时,位置会发生变化

如题:
image

        pageView.delegate = self
        self.addSubview(pageView)
        pageView.whc_Left(0)
            .whc_Top(0)
            .whc_Right(0)
            .whc_Bottom(0)
        
        let layoutParam = WHC_PageViewLayoutParam()
        layoutParam.itemLayoutStyle = .text_Image
        layoutParam.titles = ["样式一","样式二","样式三","样式四"]

        layoutParam.itemWidth = 80 /***如果标题很多一屏放不下需要设定每个标题的固定宽度否则可以忽略***/
        layoutParam.selectedTextColor = UIColor.red
        
        layoutParam.normalBackgorundColor = UIColor.white
        layoutParam.normalTextColor = UIColor.black
        layoutParam.bottomLineColor = .red
        layoutParam.bottomLineHeight = 1
        layoutParam.cursorColor = .red
        
        pageView.layoutIfNeeded()
        pageView.layoutParam = layoutParam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.