我正在做我的項目使用故事板,在我的項目中,我將解析json數據並顯示在模擬器中。這裏是我的JSONios:將html字符串轉換爲nsstring並顯示在uitableview中?
activityList = (
{
activityTitle = test;
activityType = Chat;
apiKey = null;
desc = "<p>asasasa</p>";
id = 361;
issueTitle = "Issue Created By m43 (194)";
sessionId = null;
status = true;
token = null;
when = "Sat, 30 Nov 2013 04:30 AM CET";
},
{
activityTitle = "test match private";
activityType = "One Way Video Streaming";
apiKey = null;
desc = "<p>test match private</p>";
id = 335;
issueTitle = "test match (190)";
sessionId = null;
status = true;
token = null;
when = "Fri, 29 Nov 2013 10:30 AM GMT";
},
我解析JSON,並顯示在tableview中所有提交的數據,除了這desc = "<p>test match private</p>";
一個,具有將是HTML字符串的NSString問題。 somwhoe我怎樣努力,並使用該
desc1 = [[items valueForKey:@"desc"] componentsJoinedByString:@","];
NSLog(@"%@",desc1);
NSString *itemTitle = [desc1 stringByConvertingHTMLToPlainText];
NSLog(@"%@",itemTitle);
將它轉換打印我這個
<p>asasasa</p>,<p>test match private</p>,<p>test activity by m43</p>,<p>Test for chat activities</p>,<p>test 5 for admin</p>,<p>test ca activity title</p>,<p>test for video issue</p>,<p>activity for m43 by c31</p>,<p>test activity title community activism By u1</p>,<p>test 7</p>,<p>test</p>,<p>chat</p>,<p>rahul jaykar</p>,<p>test public unadkat</p>,<p>test activity</p>,<p>test chat</p>,<p>private activity</p>,<p>test session initation</p>,<p>join test <span>Your Activity Title</span><span class="required-indicator">*</span><span> </span></p>,<p>test 9</p>
,並轉換爲純文本這樣
asasasa ,test match private ,test activity by m43 ,Test for chat activities ,test 5 for admin ,test ca activity title ,test for video issue ,activity for m43 by c31 ,test activity title community activism By u1 ,test 7 ,test ,chat ,rahul jaykar ,test public unadkat ,test activity ,test chat ,private activity ,test session initation ,join test Your Activity Title* ,test 9
現在,經過我的問題是如何顯示此DATAS在uitableviewcell中存在的標籤中;
這裏是我的TableCell代碼
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier [email protected]"activismCell";
CAviewCELLCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier forIndexPath:indexPath];
cell.activitytitle.text = (NSString *)[array1 objectAtIndex:indexPath.row];
cell.idline.text = (NSString *)[array3 objectAtIndex:indexPath.row];
cell.issuelabel.text = (NSString *)[array9 objectAtIndex:indexPath.row];
cell.timelabel.text = (NSString *)[array10 objectAtIndex:indexPath.row];
cell.typelabel.text = (NSString *)[array2 objectAtIndex:indexPath.row];
sessid = (NSString *)[array4 objectAtIndex:indexPath.row];
token = (NSString *)[array6 objectAtIndex:indexPath.row];
apikey = (NSString *)[array7 objectAtIndex:indexPath.row];
for (int i=0; i<[array8 count]; i++) {
}
NSLog(@"%@,%@",sessid,token);
NSString *stat =(NSString *)[array2 objectAtIndex:indexPath.row];
NSLog(@"%@",stat);
NSString *trimmedString = [stat stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
if([trimmedString isEqualToString:@"Two Way Video Streaming"] || [trimmedString isEqualToString:@"One Way Video Streaming"]) {
[cell.startvideo setHidden:FALSE];
[cell.startvideo setImage:[UIImage imageNamed:@"ca_video.png"] forState:UIControlStateNormal];
[cell.startvideo addTarget:self action:@selector(playAction) forControlEvents:UIControlEventTouchUpInside];
}
else
[cell.startvideo setHidden:TRUE];
return cell;
}
必須使用顯示爲indexpath行中有序DATAS在cell.desclabel.text ..請幫助我如何做到這一點
請問您是否可以澄清一下,您是否想在每個單元格中顯示一次單元格或一個對象中的所有內容?我的意思是單元格1中的activityTitle,單元格2中的activityType等等。 –