iphone - Populating UITableView on a secondary view -


i have code has initial table , when click index, loads view. have code populating array correctly, code have wont populate table using array. have exact same code used populate main table, won't populate. heres code:

- (uitableviewcell *) tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell";  uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {     cell = [[uitableviewcell alloc] initwithframe:cgrectzero]; } cell.selectionstyle = uitableviewcellselectionstyleblue;  nslog(@"questions array = %@", self.answersarray);  cell.textlabel.text = [_answersarray objectatindex:indexpath.row];  return cell; } 

for reason wont print out array. have array property , being initialized in viewdidload method:

    nsinteger row = _indexofquestion.row; _tempstr = [nsstring stringwithformat:@"http://**.***.**.**/getanswer.php?num=%d", row]; self.answersarray = [[nsmutablearray alloc] init]; self.answersarray = [nsmutablearray arraywithobject: _selectedquestion]; for(int = 1; <= 4; i++) {     _hoststr = [_tempstr stringbyappendingformat:@"&ans=answer%d", i];     nsdata *dataurl = [nsdata datawithcontentsofurl:[nsurl urlwithstring: _hoststr]];     nsstring *serveroutput = [[nsstring alloc] initwithdata:dataurl encoding:nsasciistringencoding];     [self.answersarray addobject: serveroutput]; } 

some of things might have gone wrong -

  1. is nsarray populated data? (you said data present).
  2. if data present, see if have linked uitabelview in interface builder variable in code.
  3. did link uitableview delegate , datasource correct file?
  4. did inherit uitableviewdelegate , uitableviewdatasource in .h file ?

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 -