ios - Exception caused by custom cells: UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath: -
i got following exception:
fatal exception: nsinternalinconsistencyexception uitableview datasource must return cell tableview:cellforrowatindexpath:
my tableview has custom cells. code works. however, exception happened once.
-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { // cell populate uitableviewcell* cell = [tableview dequeuereusablecellwithidentifier:@"appt"]; if (!cell) { // create new cell cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"appt"]; // populate nib uinib* nib = [uinib nibwithnibname:@"scheduledrowview" bundle:nil]; nsarray* views = [nib instantiatewithowner:nil options:nil]; uiview* parent = [views objectatindex:0]; cgrect rowrect = parent.frame; rowrect.size.width = tableview.frame.size.width; parent.frame = rowrect; cell.frame = rowrect; [cell addsubview:parent]; } // populate cell // code populating cell.. return cell; }
Comments
Post a Comment