ios - tableView not found on object of type -
i have class named firstviewcontroller subclass of uiviewcontroller , have uitableview in class. need transition class new uiviewcontroller subclass (using segues) when row pressed.
i have made firstviewcontroller uitableviewdelegate , uitableviewdatasource using code -
@interface firstviewcontroller : uiviewcontroller <uitableviewdatasource, uitableviewdelegate>
i getting error on line of code -
nsindexpath *path = [self.tableview indexpathforselectedrow];
how fix problem since tableview found in uitableviewcontroller , not in uiviewcontroller class ?
edit -
here's code related table view -
- (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section{ return [sarray count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath{ static nsstring *cellid = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellid]; if(cell == nil){ cell = [[uitableviewcell alloc]initwithstyle:uitableviewcellstyledefault reuseidentifier:cellid]; } nsstring *text = [sarray objectatindex:[indexpath row]]; cell.textlabel.text = text; return cell; }
you can declare tableview property:
@property(nonatomic, strong) iboutlet uitableview *tableview;
Comments
Post a Comment