iphone - Unable to view table in RootViewController -


i have navigation app working on reason not allowing me view table on initial screen (i.e. rootviewcontroller). have following method called "viewdidload" method:`

- (void) locationmanager:(cllocationmanager *)manager   didupdatetolocation:(cllocation *)newlocation         fromlocation:(cllocation *)oldlocation { 

` work, , calls method:

- (void) readrestaurantsfromdatabase:(double)userlatitude                  withuserlocation:(double)userlongitude{ 

this method work nsarray called "sortedarray" property declared, , synthesized in rootviewcontroller:

//compile list of categories         nsmutablearray *categorylist = [[nsmutablearray alloc] init];         [categorylist addobject:@"all types"];          (restaurant *restcat in restaurants){              [categorylist addobject:restcat.category];         }           //remove duplicates          nsarray *copy = [categorylist copy];         nsinteger index = [copy count] - 1;          (nsstring *restcategory in [copy reverseobjectenumerator]) {              if ([categorylist indexofobject:restcategory inrange:nsmakerange(0, index)] != nsnotfound) {                 [categorylist removeobjectatindex:index];             }              index--;          }          [copy release];          //put list in alphabetical order         sortedarray = [categorylist sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)]; 

this how above method ends. have following code "cellforrowatindexpath" method:

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {  static nsstring *cellidentifier = @"cell";  uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) {     cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; }  // configure cell.  nsstring *cellvalue = [sortedarray objectatindex:indexpath.row]; cell.textlabel.text = cellvalue;  return cell; 

}

to me, looks fine. when run code, have nslog statements issue output console shows me nsarray sortedarray contains data. yet, when run code on iphone simulator in xcode, empty table. can see i'm doing wrong?

thanks in advance reply.

have connected tableview property in interface builder?

also, when sorted array changes, might want call [mytabelview reloaddata]; refresh table. each time change sortedarray i.e.

//put list in alphabetical order sortedarray = [categorylist sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)];  // sorted array has changed, table view refresh [mytabelview reloaddata]; 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -