iphone - Having issue with reading Plist into UITableView -


i trying display dictionary plist uitableview , have read many question , answer here no luck ! seems cells return null ! here plist : enter image description here

and codes :

-(void)viewdidload {       nsstring *path = [[nsbundle mainbundle] pathforresource:@"feed" oftype:@"plist"];     newsfeed = [nsarray arraywithcontentsoffile:path]; }   - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return newsfeed.count; }   - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {      return dictionary.allkeys.count; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     dictionary = [newsfeed objectatindex:indexpath.section];    cell.textlabel.text = [[newsfeed objectatindex:indexpath.row] valueforkey:@"title"];      return cell;  } 

and result nothing :

enter image description here

try in want display title try this

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return 1; }     - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section     {          return newsfeed.count;     }      - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath     {          dictionary = [newsfeed objectatindex:indexpath.row];         cell.textlabel.text = [dictionary valueforkey:@"title"];          return cell;      }   

edit
, if want display record try this

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     return newsfeed.count; }   - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {      return dictionary.allkeys.count; }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      dictionary = [newsfeed objectatindex:indexpath.section];      nsstring *key =[[dictionary allkeys] objectatindex:indexpath.row];      cell.textlabel.text = [dictionary valueforkey:key];      return cell;  } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -