iOS怎样将如下的数据加到一个cell上?
"articles":[{"id":83,"title":"converse","image":"http://www.wise-mall.com/img/11_26_4...
"articles":[
{
"id":83,
"title":"converse",
"image":"http://www.wise-mall.com/img/11_26_434.jpg",
"date":"2014-06-03 03:49:47 UTC",
"type":2
},
{
"id":82,
"title":"阿迪达斯",
"image":"http://www.wise-mall.com/img/11_83_419.jpg",
"date":"2014-06-03 03:49:47 UTC",
"type":2
},
{
"id":81,
"title":"耐克",
"image":"http://www.wise-mall.com/img/11_48_440.jpg",
"date":"2014-06-03 03:49:47 UTC",
"type":2
}
] 展开
{
"id":83,
"title":"converse",
"image":"http://www.wise-mall.com/img/11_26_434.jpg",
"date":"2014-06-03 03:49:47 UTC",
"type":2
},
{
"id":82,
"title":"阿迪达斯",
"image":"http://www.wise-mall.com/img/11_83_419.jpg",
"date":"2014-06-03 03:49:47 UTC",
"type":2
},
{
"id":81,
"title":"耐克",
"image":"http://www.wise-mall.com/img/11_48_440.jpg",
"date":"2014-06-03 03:49:47 UTC",
"type":2
}
] 展开
1个回答
2014-06-03
展开全部
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = [NSString stringWithFormat:@"Cell"];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
//config the cell
return cell;
}
//自定义cell
static NSString *CellIdentifier = [NSString stringWithFormat:@"Cell"];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
//config the cell
return cell;
}
//自定义cell
追问
谢谢回答 我的问题是如图中 数据中的3个title 分别加到cell,应该怎么判断
追答
indexpath.row 表示第几行。
indexpath.section表示哪个块。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询