BannerView

open class BannerView : UIView, UICollectionViewDataSource, UICollectionViewDelegate

Banner视图

SDCycleScrollView

Accessor

  • 图片数组,支持String|URL|UIImage

    Declaration

    Swift

    open var imagesGroup: [Any]? { get set }
  • 每张图片对应要显示的文字数组

    Declaration

    Swift

    open var titlesGroup: [Any]? { get set }
  • 自动滚动间隔时间,默认2s

    Declaration

    Swift

    open var autoScrollTimeInterval: TimeInterval { get set }
  • 是否无限循环,默认true

    Declaration

    Swift

    open var infiniteLoop: Bool { get set }
  • 是否自动滚动,默认true

    Declaration

    Swift

    open var autoScroll: Bool { get set }
  • 图片滚动方向,默认为水平滚动

    Declaration

    Swift

    open var scrollDirection: UICollectionView.ScrollDirection { get set }
  • 是否启用根据item分页滚动,默认false,根据frame大小滚动

    Declaration

    Swift

    open var itemPagingEnabled: Bool { get set }
  • 整体布局尺寸,默认0占满视图,itemPagingEnabled启用后生效

    Declaration

    Swift

    open var itemSize: CGSize { get set }
  • 整体布局间隔,默认0,itemPagingEnabled启用后生效

    Declaration

    Swift

    open var itemSpacing: CGFloat { get set }
  • 是否设置item分页停留位置居中,默认false,停留左侧,itemPagingEnabled启用后生效

    Declaration

    Swift

    open var itemPagingCenter: Bool { get set }
  • 事件代理

    Declaration

    Swift

    open weak var delegate: BannerViewDelegate? { get set }
  • 句柄方式监听点击,参数为index

    Declaration

    Swift

    open var didSelectItemBlock: ((Int) -> Void)?
  • 句柄方式监听滚动,快速滚动时也会回调,参数为index

    Declaration

    Swift

    open var didScrollToItemBlock: ((Int) -> Void)?
  • 自定义cell句柄,参数为cell和index

    Declaration

    Swift

    open var customCellBlock: ((UICollectionViewCell, Int) -> Void)?
  • 轮播图片的ContentMode,默认为scaleAspectFill

    Declaration

    Swift

    open var imageViewContentMode: UIView.ContentMode
  • 占位图,用于网络未加载到图片时

    Declaration

    Swift

    open var placeholderImage: UIImage?
  • 是否显示分页控件

    Declaration

    Swift

    open var showsPageControl: Bool { get set }
  • 自定义pageControl控件,初始化后调用

    Declaration

    Swift

    open var customPageControl: ((UIControl) -> Void)?
  • 是否在只有一张图时隐藏pagecontrol,默认为true

    Declaration

    Swift

    open var hidesForSinglePage: Bool
  • 只展示文字轮播

    Declaration

    Swift

    open var onlyDisplayText: Bool
  • pageControl 样式,默认为系统样式

    Declaration

    Swift

    open var pageControlStyle: BannerViewPageControlStyle
  • 分页控件位置

    Declaration

    Swift

    open var pageControlAlignment: BannerViewPageControlAlignment
  • 分页控件距离轮播图的底部间距(在默认间距基础上)的偏移量

    Declaration

    Swift

    open var pageControlBottomOffset: CGFloat
  • 分页控件距离轮播图的右边间距(在默认间距基础上)的偏移量

    Declaration

    Swift

    open var pageControlRightOffset: CGFloat
  • 分页控件小圆标大小

    Declaration

    Swift

    open var pageControlDotSize: CGSize { get set }
  • 分页控件当前小圆标大小,默认zero同pageControlDotSize

    Declaration

    Swift

    open var pageControlCurrentDotSize: CGSize { get set }
  • 分页控件小圆标间隔

    Declaration

    Swift

    open var pageControlDotSpacing: CGFloat { get set }
  • 当前分页控件小圆标颜色

    Declaration

    Swift

    open var currentPageDotColor: UIColor? { get set }
  • 其他分页控件小圆标颜色

    Declaration

    Swift

    open var pageDotColor: UIColor? { get set }
  • 当前分页控件小圆标图片

    Declaration

    Swift

    open var currentPageDotImage: UIImage? { get set }
  • 其他分页控件小圆标图片

    Declaration

    Swift

    open var pageDotImage: UIImage? { get set }
  • 分页控件自定义视图类,默认为DotView

    Declaration

    Swift

    open var pageDotViewClass: (UIView & DotViewProtocol).Type? { get set }
  • 轮播文字label字体颜色

    Declaration

    Swift

    open var titleLabelTextColor: UIColor?
  • 轮播文字label字体

    Declaration

    Swift

    open var titleLabelTextFont: UIFont?
  • 轮播文字label背景颜色

    Declaration

    Swift

    open var titleLabelBackgroundColor: UIColor?
  • 轮播文字label高度

    Declaration

    Swift

    open var titleLabelHeight: CGFloat
  • 轮播文字间距设置(影响背景),默认全部0

    Declaration

    Swift

    open var titleLabelInset: UIEdgeInsets
  • 轮播文字内容间距设置(不影响背景),默认{0 16 0 16}

    Declaration

    Swift

    open var titleLabelContentInset: UIEdgeInsets
  • 轮播文字label对齐方式

    Declaration

    Swift

    open var titleLabelTextAlignment: NSTextAlignment
  • 图片视图间距设置,默认全部0

    Declaration

    Swift

    open var imageViewInset: UIEdgeInsets
  • 内容视图间距设置,默认全部0

    Declaration

    Swift

    open var contentViewInset: UIEdgeInsets
  • 内容视图圆角设置,默认0

    Declaration

    Swift

    open var contentViewCornerRadius: CGFloat
  • 内容视图背景色,默认nil

    Declaration

    Swift

    open var contentViewBackgroundColor: UIColor?
  • 当前index,默认-1

    Declaration

    Swift

    open private(set) var currentIndex: Int { get }

Subviews

  • Undocumented

    Declaration

    Swift

    open private(set) lazy var mainView: UICollectionView { get set }
  • Undocumented

    Declaration

    Swift

    open private(set) lazy var flowLayout: BannerViewFlowLayout { get set }
  • Undocumented

    Declaration

    Swift

    open private(set) weak var pageControl: UIControl? { get }

Lifecycle

  • Undocumented

    Declaration

    Swift

    public override init(frame: CGRect)
  • Undocumented

    Declaration

    Swift

    public required init?(coder: NSCoder)
  • Undocumented

    Declaration

    Swift

    open override func layoutSubviews()
  • Undocumented

    Declaration

    Swift

    open override func willMove(toSuperview newSuperview: UIView?)

UICollectionView

Public

  • 手工滚动到指定index,可指定动画

    Declaration

    Swift

    open func scrollToIndex(_ index: Int, animated: Bool = false)
  • 滚动手势禁用(文字轮播较实用)

    Declaration

    Swift

    open func disableScrollGesture()
  • 解决viewWillAppear时出现时轮播图卡在一半的问题,在控制器viewWillAppear时调用此方法

    Declaration

    Swift

    open func adjustWhenViewWillAppear()

StatisticalViewProtocol