collectionView has 2 sections
start -->
indexPath(0, 0)
-->indexPath(1, 0
) -->indexPath(2, 0)
-->...
-->indexPath(n-1, 0)
-->indexPath(0, 1)
-->indexPath(1, 0)
-->indexPath(2, 0)
- Installation with CocoaPods:
pod 'MMAdvertScrollView', '~> 1.2.1'
var timeInterval: TimeInterval = 3.0 // 滚动间隔默认为3秒
var scrollDirection: UICollectionView.ScrollDirection = .vertical //默认滚动方向为竖向
let m1 = MMAdvertScrollView(frame: CGRect(x: 0, y: 135, width: UIScreen.main.bounds.width, height: 40))
m1.dataArray = ["恭喜xx,完成了数据管理能力测评。" ,"恭喜xxxxxxxxxxxxxx,完成实名认证。"]
view.addSubview(m1)
public protocol MMAdvertScrollCustomerViewDelegate: AnyObject{
func customerViewDataArrayCount() -> Int
func customViewConfigure(numberOfItems item: Int, cycleView view: MMAdvertScrollView) -> UIView
func collectionView(_ cycleView: MMAdvertScrollView, didSelectItemAt indexItem: Int)
}
extension CustomerView: MMAdvertScrollCustomerViewDelegate {
func customViewConfigure(numberOfItems item: Int, cycleView view: MMAdvertScrollView) -> UIView {
let view = VipView()
view.title = dataArray[item]
return view
}
func customerViewDataArrayCount() -> Int {
return dataArray.count
}
}
- ARC
- iOS>=11.0