objective c - ios:convert html string to nsstring and display in uitableview? -


am doing project using storyboards, in project parse json data , display in simulator. here json

activitylist =     (                 {             activitytitle = test;             activitytype = chat;             apikey = null;             desc = "<p>asasasa</p>";             id = 361;             issuetitle = "issue created m43 (194)";             sessionid = null;             status = true;             token = null;             when = "sat, 30 nov 2013 04:30 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 gmt";         }, 

i parsed json , displayed datas in tableview except desc = "<p>test match private</p>"; a, having problem converting html string nsstring. somwhoe how tried , converted using this

 desc1 = [[items  valueforkey:@"desc"] componentsjoinedbystring:@","];     nslog(@"%@",desc1);     nsstring *itemtitle = [desc1 stringbyconvertinghtmltoplaintext];     nslog(@"%@",itemtitle); 

it printed me this

<p>asasasa</p>,<p>test match private</p>,<p>test activity m43</p>,<p>test chat activities</p>,<p>test 5 admin</p>,<p>test ca activity title</p>,<p>test video issue</p>,<p>activity m43 c31</p>,<p>test activity title community activism 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&nbsp;<span>your activity title</span><span class="required-indicator">*</span><span>&nbsp;</span></p>,<p>test 9</p> 

and after converting plain text this

asasasa ,test match private ,test activity m43 ,test chat activities ,test 5 admin ,test ca activity title ,test video issue ,activity m43 c31 ,test activity title community activism 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  

now problem how display datas in label present in uitableviewcell;

here tablecell code

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     static nsstring *simpletableidentifier =@"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];     (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; } 

have display datas in orderly in cell.desclabel.text using indexpath row.. pls me how

create array plaintext string below way.

desc1 = [[items  valueforkey:@"desc"] componentsjoinedbystring:@","]; nslog(@"%@",desc1); nsstring *itemtitle = [desc1 stringbyconvertinghtmltoplaintext]; nsarray *arrnew = [itemtitle componentsseparatedbystring:@","]; 

now change cell label.

cell.desclabel.text = [arrnew objectatindex:indexpath.row]; 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -