一个可以高度自定义的iOS跑马灯。
功能点:
1.高度自定义视图。
2.适用多种跑马灯应用场景。
3.代码简单,扩展便捷。
使用 cocoapods
pod 'DYMarqueeView'
当前最新版本1.0.0,如果不能搜索最新版本,执行命令 pod setup更新pod后再试。
持续优化中,如果有好的建议和意见欢迎交流,QQ群:433212576
类似于UITableView,详细用法见Demo。
/**
#pragma mark - DYMarqueeViewDelagete
- (NSInteger)numberOfMarqueeView:(DYMarqueeView *)marqueeView {
return 4;
}
- (UIView *)marqueeView:(DYMarqueeView *)marqueeView cellViewWithIndexPath:(NSIndexPath *)indexPath {
MarqueeTestCell *cell = [marqueeView dequeueReusableCellWithIndexPath:indexPath];
if (!cell) {
cell = [[MarqueeTestCell alloc] init];
}
cell.index = indexPath.row;
[cell.button setTitle:_dataArray[indexPath.row] forState:UIControlStateNormal];
return cell;
}
- (CGFloat)marqueeView:(DYMarqueeView *)marqueeView widthCellWithIndex:(NSInteger)index {
if (marqueeView.tag == 1000 ) {
return self.view.bounds.size.width;
}
return 50;
}