ios - UITableViewCell staying empty -


i trying fill uitableview objects of nsmutablearray filled table in parse. array being filled (i checked contents nslog), table staying empty. have tried lot of different ways including following:

- (uitableviewcell *) tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     tableviewcell *cell = [tableview dequeuereusablecellwithidentifier:@"cell"];      pfobject *postsobject = [postsarray objectatindex:indexpath.row];     cell.textlabel.text = [postsobject objectforkey:@"message"];     cell.textlabel.textalignment = nstextalignmentcenter;      if (!cell) {         cell = [[tableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"cell"];         cell.accessorytype = uitableviewcellaccessorydisclosureindicator;      }      if (tableview == table) {         cell.textlabel.text = [postsarray objectatindex:indexpath.row];     }      return cell; } 

and simpler

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {     tableviewcell *cell = [table dequeuereusablecellwithidentifier:@"cell"];      cell.messagelabel.text = [nsstring stringwithformat:[postsarray objectatindex:[indexpath row]]];      return cell; } 

does have ideas?

thanks in advance :)

edit:

my datasource methods are:

- (nsinteger) numberofsectionsintableview:(uitableview *)tableview {     return 1; }  - (nsinteger) tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     return postsarray.count; } 

edit #2:

my code i'm using fill array , reload tableview

pfquery *finddata = [pfquery querywithclassname:@"allposts"];     [finddata setlimit:1000];     [finddata findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) {         if (error == nil) {             (pfobject *object in objects) {                 pfobject *post = object[@"content"];                 nsmutablearray *array = [[nsmutablearray alloc] initwithobjects:post, nil];                 postsarray = array;                 [table reloaddata];             }         } else {             uialertview *alert = [[uialertview alloc] initwithtitle:@"error" message:@"unable load" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil];             [alert show];         }     }]; 

you doing wrong , replacing array new data whenever finding pfobject in objects, code should this:-

//first alloc array   postsarray=[[nsmutablearray alloc] init]; //logic goes here     pfquery *finddata = [pfquery querywithclassname:@"allposts"];         [finddata setlimit:1000];         [finddata findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) {             if (error == nil) {                 (pfobject *object in objects) {                     pfobject *post = object[@"content"];                     nsmutablearray *array = [[nsmutablearray alloc] initwithobjects:post, nil];                     [postsarray addobject:array];                     [table reloaddata];                 }             } else {                 uialertview *alert = [[uialertview alloc] initwithtitle:@"error" message:@"unable load" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil];                 [alert show];             }         }]; 

Comments