美文网首页
ios轮播图YJShufflingScrollView

ios轮播图YJShufflingScrollView

作者: BLUEVIPIOS_ | 来源:发表于2019-11-15 00:10 被阅读0次

YJShufflingScrollView使用及属性
工程所用到的三方 Masonry、SDWebImage 若不想使用 可以自己修改
工程注释方面 很详细

/** pageControl位置 左右中 */
@property (nonatomic, assign) PageContolAliment pageControlAliment;
/** 是否无限循环 */
@property(nonatomic,assign)BOOL loop;
/** 是否开启定时任务 */
@property(nonatomic,assign)BOOL autoScroll;
/** 标题字体 左右中 */
@property (nonatomic, assign) NSTextAlignment titleLabelTextAlignment;
/** 滑动方向 */
@property (nonatomic, assign) PagescrollDirection PagescrollDirection;
/** 监听点击 */
@property (nonatomic, copy) void (^didSelectItemBlock)(NSInteger SelectIndex);
/** PageControl距离下方的边距 */
@property (nonatomic, assign) CGFloat bottomMargin;
/** 图片渲染模式 */
@property (nonatomic, assign) UIViewContentMode bannerImageViewContentMode;
/** 行间距 */
@property(nonatomic,assign) CGFloat lineWidth;
/** 列间距 */
@property(nonatomic,assign) CGFloat columnWidth;
/** cell大小 */
@property(nonatomic,assign) CGSize kitemSize;

注意点
1.图片数据源不可为空 而且必须为字符串数组
2.若要显示标题 需标题数组与图片数组一致
3.pageControl 可设置图片 一旦设置图片 颜色属性就会失效
4.PagesStyle属性 PagesStyleComent普通样式 PagesStyleCartoon卡片轮播样式
使用示例

YJShufflingScrollView * ShufflingScrollView =[[YJShufflingScrollView alloc]initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, 200) imagesStrs:arrr placeholderImage:[UIImage imageNamed:@"placeholder"]PagesStyle:PagesStyleCartoon];
    ShufflingScrollView.currentPage = 1;
    ShufflingScrollView.didSelectItemBlock = ^(NSInteger SelectIndex) {
        NSLog(@"------%zd",SelectIndex);
    };

 YJShufflingScrollView * ShufflingScrollView4 =[[YJShufflingScrollView alloc]initWithFrame:CGRectMake(0, 680,self.view.frame.size.width, 200) imagesStrs:arrr placeholderImage:[UIImage imageNamed:@"placeholder"]PagesStyle:PagesStyleComent];
    ShufflingScrollView4.PagescrollDirection = PagescrollDirectionHorizontal;
    ShufflingScrollView4.autoScroll=YES;
    ShufflingScrollView4.loop = YES;
    ShufflingScrollView4.isShowPageControl = NO;
    ShufflingScrollView4.isShowtitleLabe =YES;
    [demoContainerView addSubview:ShufflingScrollView4];
    ShufflingScrollView4.titles = arrr;
    ShufflingScrollView4.titleLabelTextFont = [UIFont systemFontOfSize:15];
    ShufflingScrollView4.didSelectItemBlock = ^(NSInteger SelectIndex) {
        NSLog(@"---%@-%@-",@(SelectIndex),arrr[SelectIndex]);
    };

关与布局样式 共俩中 普通样式与卡片样式 工程采用UICollectionView实现俩种布局方式。
1 若要修改cell样式 可直接更换自己创建的cell即可
2 若要修改其布局样式 可以重写flowLayout 的方法 flowLayout继承与UICollectionViewFlowLayout
其中
//存储cell排布方式
.layoutAttributesForElementsInRect
//停留的位置

  • (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity
    等函数即可实现

YJPageControl继承UIPageControl
设置关于YJPageControl里面的属性 只需要查看 YJShufflingScrollView里面的属性,都已做注释

等等 demo工程

https://github.com/YUYINGJIE/YJShufflingScrollView/tree/master/YJShufflingScrollView

使用过程中若有疑问 bug 请及时 提出 非常感谢 工程会不断优化更新

附上效果图


Simulator Screen Shot - iPhone X - 2019-11-15 at 00.13.35.png

相关文章

  • ios轮播图YJShufflingScrollView

    YJShufflingScrollView使用及属性工程所用到的三方 Masonry、SDWebImage 若不...

  • 轮播大法——SDCycleScrollView 源码思路解析

    SDCycleScrollView 轮播图源码解析 一、开篇 轮播图控件,在 iOS 应用上是有很多应用的。 这个...

  • iOS使用UIScrollView实现无限循环轮播图

    何为轮播图?在 iOS中其实就是利用UIScrollView来展示超出屏幕范围的图片或者是其它内容。轮播图又分为手...

  • iOS 轮播图

    轮播图几乎是每一个 App 都会有的功能,而在 UIKit 中又找不到能够直接实现轮播图的视图控件。因此我们需要通...

  • ios 轮播图

    好的第三方 http://www.code4app.com/thread-14507-1-1.html

  • ios 轮播图

    #import "ViewController.h" #import "oneViewController.h" ...

  • iOS轮播图

    用collectionView自定义实现一个无限滚动的轮播图 这里主要说一下无限轮播的核心思路和解决方案 我先以s...

  • iOS 轮播图

  • IOS 轮播图

    轮播图有很多种方式创建,其中利用collectionView是最为简单的一种,以下为这种方式的思路代码。 初始化c...

  • iOS 轮播图

    轮播图是App中常用的展示界面,主要用到的控件有UIScrollView和UIPageControl。难点有两处,...

网友评论

      本文标题:ios轮播图YJShufflingScrollView

      本文链接:https://www.haomeiwen.com/subject/ciqdictx.html