0
URL에서 일부 데이터를 구문 분석 중이므로 올바르게 데이터를 검색 할 수 있습니다. 이제 해당 데이터를 사용자 정의 tableview에 표시하고 싶지만 테이블에 데이터를 표시 할 수 없습니다. 나는 데이터가 테이블에 표시되는 것보다 cell.textlabel.text = [titleNoFormatting objectAtIndex:indexPath.row];
작성하는 경우 여기에 내 코드UITableView의 버그 표시 코드
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [url count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
UILabel *LBtitle = [[UILabel alloc]initWithFrame:CGRectMake(60, 5, 250, 40)];
LBtitle.font = [UIFont boldSystemFontOfSize:13.0];
LBtitle.numberOfLines=2;
[LBtitle sizeToFit];
UILabel *LBurl = [[UILabel alloc]initWithFrame:CGRectMake(60, 45, 250, 20)];
LBurl.font = [UIFont systemFontOfSize:13.0];
LBurl.textColor = [UIColor blueColor];
LBurl.numberOfLines=1;
[LBurl sizeToFit];
UILabel *LBcontent = [[UILabel alloc]initWithFrame:CGRectMake(60, 65, 250, 60)];
LBcontent.font = [UIFont systemFontOfSize:13.0];
LBcontent.textColor = [UIColor grayColor];
LBcontent.numberOfLines=3;
[LBcontent sizeToFit];
LBtitle.text = [titleNoFormatting objectAtIndex:indexPath.row];
LBurl.text = [url objectAtIndex:indexPath.row];
LBcontent.text = [content objectAtIndex:indexPath.row];
[cell.contentView addSubview:LBtitle];
[cell.contentView addSubview:LBurl];
[cell.contentView addSubview:LBcontent];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
//cell.textLabel.text = [titleNoFormatting objectAtIndex:indexPath.row];
//cell.detailTextLabel.text = [url objectAtIndex:indexPath.row];
// Configure the cell...
if (indexPath.row % 2 == 0) {
cell.backgroundColor = [UIColor whiteColor];
}
else{
cell.backgroundColor = [UIColor colorWithRed:231/255.0 green:227/255.0 blue:227/255.0 alpha:1.0];
}
return cell;
}
입니다.
[url]이 (가) 선언 된 코드를 표시하십시오. 올바른 정보를 얻습니까? [titleNoFormatting]은 무엇입니까? – Martol1ni
시도해 보셨습니까? [cell addSubview : LBtitle]; – kidsid49
titlenotformatting, url 및 content는 json 응답에서 파싱 한 nsmutablearray이며 모든 배열에 데이터를 가져올 수 있습니다. 그리고 내가 테이블에 데이터를 표시하는 경우 cell.textlabel.text = [titlenotformatting objectatindex : index path.row]보다 데이터를 표시 할 수 있습니다. 그래서 문제가 배열이나 구문 분석에 있다고 생각하지 않습니다 –