【发布时间】:2014-12-10 08:02:24
【问题描述】:
在 json 中作为新人工作,我想在 tableview 单元格中显示数据,但是当我填充我的 table view 单元格时,它给出了上面提到的异常。我以前曾问过这个问题,但没有得到确切的解决方案 我收到这样的响应,因为确实加载了
-(void)inboxmessagesGetSuccess:(FBGenericWebHandler*)handler response:(NSDictionary*)response
{
NSLog (@"Count %d", [[response objectForKey:@"messageResponse"] length] );
NSMutableArray *inboxArray = [[NSMutableArray alloc] init];
NSArray *firstarray=[[[response objectForKey:@"messageResponse"] objectAtIndex:1] objectForKey:@"messages"];
for(NSDictionary *tmp in firstarray)
{
NSMutableDictionary *messages=[[NSMutableDictionary alloc]init];
[messages setValue:[tmp objectForKey:@"messageId"] forKey:@"messageId"];
// [self.inboxmessagesarray addObject:messages];
}
[self.activitiesTableView_ reloadData];
}
但是当我填充我的单元格时
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *tableviewidentifier = @"cell";
tablecellTableViewCell *cell= [self.activitiesTableView_ dequeueReusableCellWithIdentifier:tableviewidentifier];
if(cell==nil)
{
cell = [[tablecellTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:tableviewidentifier];
}if(indexPath.row == [self tableView:tableView numberOfRowsInSection:indexPath.section] - 1){
// [[cell textLabel] setText:@"Load more records"];
}
UILabel *valuedate = (UILabel *)[cell viewWithTag:21];
UILabel *msg = (UILabel *)[cell viewWithTag:22];
UILabel *date = (UILabel *)[cell viewWithTag:23];
UILabel *time = (UILabel *)[cell viewWithTag:24];
valuedate.text=[[self.inboxmessagesarray objectAtIndex:indexPath.row]objectForKey:@"messageId"];
return cell;
}
它给出了一个例外。 thanx 提前真的卡在里面很多天了。
【问题讨论】:
-
在第一个数组中 2o 个对象即将到来。并且在 inboxmessages 数组消息 id 正在填充,但是当我填充 tableview 单元格时,它给出了一个异常。
-
不,现在是 15,你可以查看我附加的项目
-
我是不是犯了一些愚蠢的错误,因为我把我的 pjct 附在上面了..
-
从问题中删除您的 Dropbox 链接。
-
赞成你的问题,看来你的分数少了,所以...
标签: ios json uitableview