JXRollView 图片无限轮播

@interface ViewController()
{
}
@property(nonatomic,strong)JXRollView * scrollTopView;
@end
-(void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [[NSNotificationCenter defaultCenter]postNotificationName:JXRollViewPause object:nil];
}
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[NSNotificationCenter defaultCenter]postNotificationName:JXRollViewPlay object:nil];
}
- (void)viewDidLoad {
    [superviewDidLoad];
    _scrollTopView=[[JXRollView alloc]initWithFrame:CGRectMake(0,0,ScreenWidth,175.0/375*ScreenWidth) indicatorImageNormal:nil/*[UIImage imageNamed:@"indicatorImageNormal"]*/ indicatorImageHighlight:nil/*[UIImage imageNamed:@"indicatorImageHighlight"]*/ animateInterval:M_PI tapAction:^(NSIntegertapIndex) {
     __strong__typeof(weakSelf) strongSelf = weakSelf; 
     [strongSelfrollViewTapIndex:tapIndex];
    }];
    [self.view addSubview:_scrollTopView];
    NSMutableArray *arrUrls = [NSMutableArray array];
    //往数组里面添加图片的URL
    [arrUrls addObject:[NSURL URLWithString:model.imgurl]];
    [_scrollTopView jx_refreshRollViewByUrls:arrUrls];
}
- (void)rollViewTapIndex:(NSInteger)tapIndex {
//图片点击事件的实现
}

附上guthub地址:https://github.com/augsun/JXRollView

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容