MMBannerLayout

Custom Banner CollectionView Layout

  • Owner: MillmanY/MMBannerLayout
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

MMBannerLayout

CI Status
Version
License
Platform

Demo

demo

Setting

demo

Use Banner

    if let layout = collection.collectionViewLayout as? MMBanerLayout {
        // Space every Item
        layout.itemSpace = 5.0
        // Size for banner cell
        layout.itemSize = self.collection.frame.insetBy(dx: 40, dy: 40).size
        // scroll to inifite (ex. completed block check your content size is enough to cycle infinite)
       (collection.collectionViewLayout as? MMBanerLayout)?.setInfinite(isInfinite: true, completed: { [unowned self]                    (result) in
            // result false mean you cant infinite
       })
        // auto play
        (collection.collectionViewLayout as? MMBanerLayout)?.autoPlayStatus = .play(duration: 2.0)
        // angle need to be (0~90)
        layout.angle = 45
    }

Use BannerLayoutDelegate

    //(Just setting self.collectionView.delegate = [your target])
    extension [your Target]: BannerLayoutDelegate {
             // Current IndexPath on center
            func collectionView(_ collectionView: UICollectionView, focusAt indexPath: IndexPath) {
                 print("Focus on \(indexPath)")
            }
    }

Installation

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

(if you cant find pod command "pod repo update")
pod "MMBannerLayout"

Author

millmanyang@gmail.com

License

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

Main metrics

Overview
Name With OwnerMillmanY/MMBannerLayout
Primary LanguageSwift
Program languageSwift (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2017-07-12 17:35:40
Pushed At2020-02-12 08:02:15
Last Commit At2020-02-12 16:00:33
Release Count22
Last Release Name5.0.8 (Posted on )
First Release Name1.0.0 (Posted on )
用户参与
Stargazers Count176
Watchers Count6
Fork Count18
Commits Count46
Has Issues Enabled
Issues Count12
Issue Open Count7
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private