YLBanner 0.1.3

YLBanner 0.1.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2016
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by hoggenw.



YLBanner 0.1.3

  • By
  • dev-wangliugen

YLBanner

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

YLBanner is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "YLBanner"

调用方法


       let bannerScroller = YLBanner(frame: CGRect(x: 0, y: 0, width: MAIN_WIDTH, height:BannerHeight), 3)
        //你的数据源    
        var array  = [UIImageView]()

        for model in dataArray[0] {
            array.append(model.bannerImageView)
        }
       // 获取数据源
        bannerScroller?.contentViewAtIndex = {(_ pageIndex: Int) in
            if array.count > 0 {
                return array[pageIndex]
            }
            return UIImageView()
        }


        //获取轮播张数,大于1启动轮播
        bannerScroller?.setTotalPagesCount(totalPageCout: { () -> (Int) in
                return array.count

        })

        //点击回调响应
        bannerScroller?.tapActionBlock = {[weak self](index) in
            if (self?.dataArray[0].count)! > 0 {
                let model = self?.dataArray[0][index]
                MobClick.event("Banner")
                print("model?.url=\(model?.url)")
                self?.dealModel(model: model!)
            }


        }

Author

hoggenw

License

YLBanner is available under the MIT license. See the LICENSE file for more info.