Code Monkey home page Code Monkey logo

huscrollcycle's Introduction

HUScrollCycle

一张图片实现的轮播图,支持网络图片

Usage

 let images = ["a.jpg", "b.jpg","c.jpg","d.jpg",].flatMap {
            return UIImage(named: $0)
 }
        
 let cycleView = HUScrollCycleView(frame: CGRectMake(0, 64, self.view.frame.size.width, 200))
 cycleView.delegate = self
 cycleView.images = images
 cycleView.currentPageIndicatorTintColor = UIColor.redColor()
 self.view.addSubview(cycleView)    

加载网络图片:

cycleView.placeholderImage = UIImage(named:"a.jpg")
cycleView.imageURLStringGroup = ["http://1.7feel.cc/yungou/statics/uploads/banner/20160715/85964915563838.jpg",
                                 "http://1.7feel.cc/yungou/statics/uploads/banner/20160715/20274054563730.jpg",
                                 "http://1.7feel.cc/yungou/statics/uploads/banner/20160715/40912708563719.jpg",
                                 "http://1.7feel.cc/yungou/statics/uploads/touimg/20160718/img193.jpg"];

在代理中,你可以得到当前点击图片的下标:

func scrollCycleView(view: HUScrollCycleView, didSelectedItemAtIndex index: Int) {
        print("tap at \(index)")
}

其他一些属性:

属性 说明
timeInterval 轮播时间间隔
pageIndicatorTintColor pageControl颜色
currentPageIndicatorTintColor pageControl当前位置颜色
autoScrollEnable 是否自动轮播
pageControlHidden 是否隐藏pageControl

Install

下载zip包,解压后将HUScrollCycleView文件夹拖入工程中,点击你的工程,在相应的targetBuild Settings中找到Swift Compiler,鼠标双击Objective-C Bridging Header,将HUScrollCycle-Bridging-Header.h拖入到弹出框中,这样Xcode就能找到OC的头文件了。

Other

  • HUScrollCycle中的网络图片下载并没有使用其他第三方库,所以你可以放心使用而不会对你项目产生影响。你只要按照上面的方法正确的导入HUScrollCycle-Bridging-Header.h就可以正常使用了。
  • HUScrollCycle是使用Swift开发的,如果你需要OC版本可以联系我:)

huscrollcycle's People

Contributors

hujewelz avatar

Stargazers

 avatar 朱晓辉 avatar

Watchers

James Cloos avatar  avatar

Forkers

coderzhuxh

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.