ios - [UITableViewCellContentView setText:]: unrecognized selector sent to instance -
i have created custom uitableviewcell xib , connected labels on outlets property. when use cell in uitableviewcontroller class set text on it, app crashes during runtime "[uitableviewcellcontentview settext:]: unrecognized selector sent instance" error. below code:
custom table view cell .h , .m files:
#import <uikit/uikit.h> @interface customtableviewcell : uitableviewcell @property (weak, nonatomic) iboutlet uilabel *branchname; @property (weak, nonatomic) iboutlet uilabel *address; @end @implementation customtableviewcell - (void)awakefromnib { [super awakefromnib]; // initialization code } - (void)setselected:(bool)selected animated:(bool)animated { [super setselected:selected animated:animated]; // configure view selected state } @end
my uitableviewcontroller code:
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { nsstring *branchlistcellid = @"branchlist"; customtableviewcell *branchlistcell = [tableview dequeuereusablecellwithidentifier:branchlistcellid]; if (!branchlistcell) { [tableview registernib:[uinib nibwithnibname:@"customtableviewcell" bundle:nil] forcellreuseidentifier:branchlistcellid]; branchlistcell = [tableview dequeuereusablecellwithidentifier:branchlistcellid]; branchlistcell.accessorytype = uitableviewcellaccessorydisclosureindicator; branchlistcell.textlabel.linebreakmode = nslinebreakbywordwrapping; branchlistcell.textlabel.numberoflines = 0; branchlistcell.textlabel.font = [uifont fontwithname:@"helvetica" size:17.0]; } return branchlistcell; } - (void)tableview:(uitableview *)tableview willdisplaycell:(customtableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath { //uilabel *branchname = (uilabel *)[cell.branchname viewwithtag:1]; cell.branchname.text = [self.branchlist objectatindex:[indexpath row]]; }
looking @ solution other questions same crash here @ so, tries setting viewwithtag other 0. tried recreating outlets. nothing helped.
what missing here?
Comments
Post a Comment