FWBannerView


@interface FWBannerView : UIView

FWBannerView

  • 初始轮播图(推荐使用)

    Declaration

    Objective-C

    + (nonnull instancetype)
        bannerViewWithFrame:(CGRect)frame
                   delegate:(nullable id<FWBannerViewDelegate>)delegate
           placeholderImage:(nullable UIImage *)placeholderImage;
  • Undocumented

    Declaration

    Objective-C

    + (instancetype)bannerViewWithFrame:(CGRect)frame imageURLStringsGroup:(nullable NSArray *)imageURLStringsGroup;
  • 本地图片轮播初始化方式

    Declaration

    Objective-C

    + (nonnull instancetype)bannerViewWithFrame:(CGRect)frame
                                imageNamesGroup:(nullable NSArray *)imageNamesGroup;
  • 本地图片轮播初始化方式2,infiniteLoop:是否无限循环

    Declaration

    Objective-C

    + (nonnull instancetype)bannerViewWithFrame:(CGRect)frame
                             shouldInfiniteLoop:(BOOL)infiniteLoop
                                imageNamesGroup:(nullable NSArray *)imageNamesGroup;
  • 网络图片 url string 数组

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSArray *imageURLStringsGroup;
  • 每张图片对应要显示的文字数组

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSArray *titlesGroup;
  • 本地图片数组

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSArray *localizationImageNamesGroup;
  • 自动滚动间隔时间,默认2s

    Declaration

    Objective-C

    @property (nonatomic) CGFloat autoScrollTimeInterval;
  • 是否无限循环,默认Yes

    Declaration

    Objective-C

    @property (nonatomic) BOOL infiniteLoop;
  • 是否自动滚动,默认Yes

    Declaration

    Objective-C

    @property (nonatomic) BOOL autoScroll;
  • 图片滚动方向,默认为水平滚动

    Declaration

    Objective-C

    @property (nonatomic) UICollectionViewScrollDirection scrollDirection;
  • 是否启用根据item分页滚动,默认NO,根据frame大小滚动

    Declaration

    Objective-C

    @property (nonatomic) BOOL itemPagingEnabled;
  • 整体布局尺寸,默认占满视图,itemPagingEnabled启用后生效

    Declaration

    Objective-C

    @property (nonatomic) CGSize itemSize;
  • 整体布局间隔,默认0,itemPagingEnabled启用后生效

    Declaration

    Objective-C

    @property (nonatomic) CGFloat itemSpacing;
  • 是否设置item分页停留位置居中,默认NO,停留左侧,itemPagingEnabled启用后生效

    Declaration

    Objective-C

    @property (nonatomic) BOOL itemPagingCenter;
  • 设置事件代理

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<FWBannerViewDelegate> delegate;
  • block方式监听点击

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(NSInteger) clickItemOperationBlock;
  • block方式监听滚动,快速滚动时也会回调

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^)(NSInteger) itemDidScrollOperationBlock;
  • 手工滚动到指定index,不使用动画

    Declaration

    Objective-C

    - (void)makeScrollViewScrollToIndex:(NSInteger)index;
  • 手工滚动到指定index,可指定动画

    Declaration

    Objective-C

    - (void)makeScrollViewScrollToIndex:(NSInteger)index animated:(BOOL)animated;
  • 解决viewWillAppear时出现时轮播图卡在一半的问题,在控制器viewWillAppear时调用此方法

    Declaration

    Objective-C

    - (void)adjustWhenControllerViewWillAppear;
  • 轮播图片的ContentMode,默认为 UIViewContentModeScaleAspectFill

    Declaration

    Objective-C

    @property (nonatomic) UIViewContentMode bannerImageViewContentMode;
  • 占位图,用于网络未加载到图片时

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *placeholderImage;
  • 是否显示分页控件

    Declaration

    Objective-C

    @property (nonatomic) BOOL showPageControl;
  • 自定义pageControl控件,初始化后调用

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (UIControl *_Nonnull __strong) customPageControl;
  • 是否在只有一张图时隐藏pagecontrol,默认为YES

    Declaration

    Objective-C

    @property (nonatomic) BOOL hidesForSinglePage;
  • 只展示文字轮播

    Declaration

    Objective-C

    @property (nonatomic) BOOL onlyDisplayText;
  • pageControl 样式,默认为系统样式

    Declaration

    Objective-C

    @property (nonatomic) FWBannerViewPageControlStyle pageControlStyle;
  • 分页控件位置

    Declaration

    Objective-C

    @property (nonatomic) FWBannerViewPageControlAlignment pageControlAlignment;
  • 分页控件距离轮播图的底部间距(在默认间距基础上)的偏移量

    Declaration

    Objective-C

    @property (nonatomic) CGFloat pageControlBottomOffset;
  • 分页控件距离轮播图的右边间距(在默认间距基础上)的偏移量

    Declaration

    Objective-C

    @property (nonatomic) CGFloat pageControlRightOffset;
  • 分页控件小圆标大小

    Declaration

    Objective-C

    @property (nonatomic) CGSize pageControlDotSize;
  • 分页空间小圆标间隔

    Declaration

    Objective-C

    @property (nonatomic) CGFloat pageControlDotSpacing;
  • 当前分页控件小圆标颜色

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *currentPageDotColor;
  • 其他分页控件小圆标颜色

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *pageDotColor;
  • 当前分页控件小圆标图片

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *currentPageDotImage;
  • 其他分页控件小圆标图片

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIImage *pageDotImage;
  • 其他分页控件自定义视图类,默认FWDotView

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) Class pageDotViewClass;
  • 轮播文字label字体颜色

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *titleLabelTextColor;
  • 轮播文字label字体大小

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIFont *titleLabelTextFont;
  • 轮播文字label背景颜色

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *titleLabelBackgroundColor;
  • 轮播文字label高度

    Declaration

    Objective-C

    @property (nonatomic) CGFloat titleLabelHeight;
  • 轮播文字label对齐方式

    Declaration

    Objective-C

    @property (nonatomic) NSTextAlignment titleLabelTextAlignment;
  • 内容视图间距设置,默认全部0

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets contentViewInset;
  • 内容视图圆角设置,默认0

    Declaration

    Objective-C

    @property (nonatomic) CGFloat contentViewCornerRadius;
  • 滚动手势禁用(文字轮播较实用)

    Declaration

    Objective-C

    - (void)disableScrollGesture;