使用方法
|
|
|
| 1. #import "ZFTableView.h" | |
| 2.在需要使用的地方添加ZFTableView 如下 | |
| ZFTableView *tab = [[ZFTableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; | |
| tab.cellInfos = self.infos; | |
| tab.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| [self.view addSubview:tab]; | |
| self.infos 是tableview的数据 | |
| 3.添加数据 | |
| 传入数据必须为包含ZFTableViewCellModel或子类型的数组 | |
| 传入cellName表示cell为代码创建的cell | |
| 传入xibCellName表示cell为xib创建的cell | |
| 自定义cell需要继承自ZFTableViewCell | |
| 如需使用tableView其他功能,请重写delegate方法 | |
| -(NSMutableArray *)infos{ | |
| if (_infos == nil) { | |
| NSMutableArray *arr =[NSMutableArray arrayWithObjects:@"ZFCollectionViewLayoutCircleType",@"ZFCollectionViewLayoutStackType",@"ZFCollectionViewFlowLayoutRotatePageType",@"ZFCollectionViewFlowLayoutWaterfallType",@"ZFCollectionViewFlowLayoutLineType", nil]; | |
| NSMutableArray *arr1 =[NSMutableArray arrayWithCapacity:1]; | |
| for (int i =0; i < arr.count; i++) { | |
| ZFTableViewCellModel *model = [[ZFTableViewCellModel alloc] init]; | |
| model.title = arr[i]; | |
| model.PopToViewController = [NSString stringWithFormat:@"%@ViewController",arr[i]]; | |
| // if (i != 1) { | |
| // model.cellName =@"demoTableViewCell"; | |
| // }else{ | |
| model.xibCellName =@"demo1TableViewCell"; | |
| // } | |
| // model.imgName =[NSString stringWithFormat:@"%i",i]; | |
| [arr1 addObject:model]; | |
| } | |
| _infos = arr1; | |
| } | |
| return _infos; | |
| } | |