ios - populating a tableview with nsmutabledata received from a webservice -
i populate tableview nsmutabledata received webservice. can data , display @ several components cannot fill tableview because following code doesn't accept nsmutabledata ;
anynsarray = [nspropertylistserialization propertylistwithdata: webdata options: 0 format:&plf error: &error]; //webdata nsmutabledata populate webservice data , anynsarray nsarray provide tableview @ - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath
here tableview populating blocks (also following code works @ view loads not fired again after click button):
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsstring *cellidentifier = [nsstring stringwithformat:@"cell%i",indexpath.row]; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstylesubtitle reuseidentifier:cellidentifier]; cell.textlabel.text = [birnsarray objectatindex:indexpath.row]; cell.detailtextlabel.text = @"any details"; } return cell; } - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return anynsarray.count; }
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [birnsarray count]; }
Comments
Post a Comment