CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

CFBannerView 0.0.4

CFBannerView 0.0.4

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Apr 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by chengfei.heng.



  • By
  • chengfei.heng

CFBannerView

Example

<img src=“https://github.com/swift365/CFBannerView/blob/master/demo.gif"  alt="效果展示” height=“568” width=“320” />

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

Use

let bannerView = CFBannerView(frame:frame)
bannerView.dataSource = self
bannerView.delegate = self
bannerView.reloadData()
        
extension ViewController:CFBannerViewDataSource,CFBannerViewDelegate{
    func numberOfItems() -> Int {
        return banners.count
    }
    
    func viewForItem(bannerView: CFBannerView, index: Int) -> UIView {
        let imageView = UIImageView(frame: bannerView.bounds)
        imageView.sd_setImage(with: URL(string: banners[index]), placeholderImage: UIImage(named: "default"))
 
        return imageView
    }
    
    func didSelectItem(index: Int) {
        print(index)
    }
}

Requirements

  • iOS 8.0+
  • Xcode 8.2+
  • Swift 3

Installation

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

pod "CFBannerView"

Author

chengfei.heng, [email protected]

License

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