Monday, 12 January 2015

Table View Won't Load Data


i have project loads array table view, no problem @ all. have created new project, has exact same code, different array, , table view loads blank. it's driving me nuts.

array loads plist follows

'currentcontent strong pointer nsarray private property of parent view.
code:
- (void) viewdidload {      nsstring *path = [[nsbundle mainbundle] pathforresource:@"customercontent" oftype:@"plist"];      nsarray *myarray = [[nsarray alloc] initwithcontentsoffile:path];      currentcontent = myarray;  }
the plist looks this
[​img]

table view data source
code:
- (nsinteger)numberofsectionsintableview:(uitableview *)tableview    {      // return number of sections.      return 1;  }    - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section  {      // return number of rows in section.      return [currentcontent count];  }    - (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];      }           cell.textlabel.text = [[currentcontent objectatindex:indexpath.row] objectforkey:@"customerfriendlyfilename"];      cell.detailtextlabel.text = [[currentcontent objectatindex:indexpath.row] objectforkey:@"publicationdate"];      return cell;  }
the data source connected in storyboard. cell reuse identified in storyboard named in code. above code has been entered in subclass of uitableviewcontroller.

storyboard tableview embedded in navigation controller. navigation controller initial view controller.

have no idea why isn't working. please help.
 

it defiantly plist. table view populate nsarray object contaning 3 strings @"one", @"two", @"three", not plist.

why isn't plist being recognised?
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment