Latest 0.1.0
Homepage https://github.com/949478479/LXCarouselView
License MIT
Platforms ios 9.0
Authors

利用 UICollectionView 实现的轮播图,可通过 UICollectionViewCell 自定义内容。

pod 'LXCarouselView'
import LXCarouselView

class CollectionViewCell: UICollectionViewCell, CarouselReusableView {
    // ...
}

class ViewController: UIViewController {

    private let textList = ["0", "1", "2", "3"]

    @IBOutlet private var pageControl: UIPageControl!
    @IBOutlet private var carouselView: CarouselView!

    override func viewDidLoad() {
        super.viewDidLoad()

        pageControl.numberOfPages = textArray.count

        carouselView.reusableViewType = CollectionViewCell.self
        carouselView.reloadData(withNumberOfPages: textList.count)
    }
}

extension ViewController: CarouselViewDelegate {

    func carouselView(_ carouselView: CarouselView, willDisplayPage page: Int) {
        print("willDisplayPage (page)")
    }

    func carouselView(_ carouselView: CarouselView, didDisplayPage page: Int) {
        print("didDisplayPage (page)")

        pageControl.currentPage = page
    }

    func carouselView(_ carouselView: CarouselView, didTapPage page: Int) {
        print("didTapPage (page)")
    }

    func carouselView(_ carouselView: CarouselView, configure cell: UICollectionViewCell, forPage page: Int) {
        print("configure (page)")

        if let cell = cell as? CollectionViewCell {
            // 配置内容。。。
        }
    }
}

Latest podspec

{
    "name": "LXCarouselView",
    "version": "0.1.0",
    "summary": "u5229u7528 UICollectionView u5b9eu73b0u7684u8f6eu64adu56feuff0cu53efu901au8fc7 UICollectionViewCell u81eau5b9au4e49u5185u5bb9u3002",
    "homepage": "https://github.com/949478479/LXCarouselView",
    "license": "MIT",
    "authors": {
        "u5415u5c0fu603c": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/949478479/LXCarouselView.git",
        "tag": "0.1.0"
    },
    "source_files": "Source/*.{swift}"
}

Pin It on Pinterest

Share This