json 데이터 (Jsp 서버)를 UITableviewcell에 표시하려고합니다. 의 I는 UITaleviewcell 세 UILables했다 제목 및 메시지와 시간 등의 데이터를 표시했다UILabel에서 html 데이터를 표시하는 방법
[{"result":[{"notification_id":106,"title":"Service Request","message":"your reqeust  PAD_0000882 is In-Process","notification_created_time":"Nov18,13"},{"notification_id":158,"title":"Service Request","message":"your reqeust  PAD_0000896 is In-Process","notification_created_time":"Nov19,13"}
내 JSON 데이터 아래에 다음과 같습니다. UILabel에서 메시지 데이터를 표시하는 방법에 대해서는 의문의 여지가 있습니다 (PAD_0000896은 진행 중임). 메시지 데이터는 html tag.i와 유사합니다. UILabel.i에 html 데이터를 표시하는 방법을 알지 못했고, 제목과 시간을 uilabel에 표시하는 방법을 알고 있습니다.
이것은 내 코드입니다.
jsondata.m
NSArray *arrResults = [dict1 valueForKey:@"result"];
listOfObjects = [NSMutableArray array];
for (NSDictionary *dictRes in arrResults)
{
for (NSDictionary *dictResSub in dictRes)
{
Attributes *at = [[Attributes alloc] init];
at.message = [dictResSub valueForKey:@"message"];
[listOfObjects addObject:at];
}
}
[tableVwTotalRequests reloadData];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *[email protected]"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"identifier"];
}
UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
myBackView.backgroundColor = [UIColor colorWithRed:0.325490196 green:0.3960784 blue:0.90196078 alpha:1];
cell.selectedBackgroundView = myBackView;
UILabel *lblDesc=[[UILabel alloc]initWithFrame:CGRectMake(10, 22, 100, 20)];
lblDesc.highlightedTextColor=[UIColor whiteColor];
lblDesc.font=[UIFont systemFontOfSize:12.0];
[cell.contentView addSubview:lblDesc];
Attributes *att = [listOfObjects objectAtIndex:indexPath.row];
strRequestId=att.requestId;
lblDesc.text=att.message;
return cell;
}
일반 텍스트로 HTML 변환을 찾으십니까? – manujmv