步骤一:
在控制文件中引入系统的方法
步骤二:
声明一个数据:可变数组
@property (nonatomic, strong) NSMutableArray *dataImage;
步骤三:
在 - (void)viewDidLoad{} 中指定代理,模拟数据的产生和请求
self.fv.tableView.dataSource = self;
[self makeData];
步骤四:
创建方法 - (void)makeData{} 定义数组
self.dataImage = [NSMutableArray array];
for (int i = 0; i < 8; i++) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@”%d.jpeg”, i]];
[self.dataImage addObject:image];
}
步骤五:
创建 重用池,添加图片数组
- (UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@”main_cell”];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@”main_cell”];
}
cell.imageView.image = self.data3[indexPath.row];
return cell;
}