Latest 1.0.4
Homepage https://github.com/changanli/LCALoopBanner
License MIT
Platforms ios 8.0
Authors

LCALoopBanner是用一个ScrollView和三个UIImageView实现的一个无限轮播器。

image

Requirements

Swift 3.0 iOS8.0 Xcode8.0

Installation

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

pod 'LCALoopBanner'
 class BannerModel:LCALoopBannerProtocol {

    /// 广告图片URL
    internal var imageURL: URL

    internal var clickBlock: (() -> ())

    init(url:URL,clickBlock:@escaping (()->())) {
        self.imageURL = url
        self.clickBlock = clickBlock
    }
}

class ViewController: UIViewController {

    var images:[String] = ["http://fdfs.xmcdn.com/group19/M04/AD/7E/wKgJJle6V2ahiSTZAAEU72DrYKE225.jpg","http://fdfs.xmcdn.com/group10/M00/6A/6D/wKgDaVc5q6WgTQflAAP0rP70Xw4865.jpg","http://fdfs.xmcdn.com/group27/M06/6C/83/wKgJW1kAQlahJ3UgAAE3bPtCzp8506.jpg","http://fdfs.xmcdn.com/group27/M08/26/1C/wKgJR1jLVjODCfl2AAGcRAN-aYg653.jpg","http://fdfs.xmcdn.com/group23/M04/92/22/wKgJNFimejfByOeXAADEj9xi3Ic318.jpg"]
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        var models = [BannerModel]()
        for urlString in images {
            if let url = URL(string: urlString) {
                 let model = BannerModel(url: url, clickBlock: { 
                    print("被点击了")
                    print(url.absoluteString)
                 })
                models.append(model)
            }
        }

        let loopBanner = LCALoopBanner.loopBanner { (imageView, url) in
           imageView.kf.setImage(with: url)
        }
        loopBanner.bannerModels = models
        loopBanner.delegate = self
        loopBanner.frame = CGRect(x: 0, y:20, width: view.bounds.size.width, height: 200)
        view.addSubview(loopBanner)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}

Author

[email protected], [email protected]

License

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

Latest podspec

{
    "name": "LCALoopBanner",
    "version": "1.0.4",
    "summary": "u4e00u4e2au65e0u9650u8f6eu64adu5668",
    "description": "u4f7fu7528UIScrollViewu548cu4e09u4e2aUIImageViewu5b9eu73b0u7684u65e0u9650u8f6eu64adu5668",
    "homepage": "https://github.com/changanli/LCALoopBanner",
    "license": "MIT",
    "authors": {
        "changan931": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/changanli/LCALoopBanner.git",
        "tag": "1.0.4"
    },
    "source_files": [
        "Classes",
        "LCALoopBanner/Classes/**/*.swift"
    ],
    "exclude_files": "Classes/Exclude",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This