ios - tableView:cellForRowAtIndexPath: returning null -


in project, have uitableview custom cell, searchcell. cell returned null value, , crash app. if choose catch null exception , alloc/init new cell, comes blank. here following code:

    #pragma mark - table view data source  - (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     // return number of sections.     return 1; }  - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     // return number of rows in section.     //return self.workingdatabase.count; causing error reason, not sure     return 1; //using 1 debugging }  - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath {      static nsstring *cellidentifier = @"infocell";     searchcell *cell = (searchcell *)[tableview dequeuereusablecellwithidentifier: cellidentifier];      /*     if(cell == nil)     {         cell = [[searchcell alloc] init];     }*/      // configure cell...     record *record = [self.workingdatabase objectatindex:indexpath.row];      //set content     cell.myname.text = record.abname;     cell.mytarget.text = record.abtarget;     cell.myvendor.text = record.abvendor;     cell.mycatnumber.text = record.abcatnumber;     cell.myclonality.text = record.abclonality;     cell.myorganism.text = record.absourceorg;      return cell; } 

the problem table view using static cells, not dynamic ones (that's important distinction way, , should made clear in question post). when use static cells, don't need (and shouldn't usually) implement uitableview data source methods. make outlet connections between labels , table view controller itself, instead of cell. in fact, don't need custom cell class @ (that's needed can connect outlets of dynamic cells). then, can populate labels other label in view.


Comments