iPhone Coding: Problem with UITableView selection -
i have strange problem uitableview. want cells in table selectable, such if cell selected, appropriate action executed. cells in table selectable apart cell @ row 0 (the cell @ appears @ top of table). cell not selectable, though has been set allow selection. ideas?
- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { tableview.allowsselection = yes; static nsstring *settingstableid = @"settingstableid"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:settingstableid]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstylevalue1 reuseidentifier: settingstableid] autorelease]; } cell.textlabel.text = [tableheadingsarray objectatindex:row]; cell.accessorytype = uitableviewcellaccessorydisclosureindicator; return cell;
}
many thanks.
sorry everyone, i'm being stupid. :) code in viewcontroller sub-class. copied class example, , forgot check on thoroughly before using it.
-(nsindexpath *)tableview:(uitableview *)tableview willselectrowatindexpath:(nsindexpath *)indexpath{ nsuinteger row = [indexpath row]; if (row == 0) return nil; return indexpath;
}
deleting has fixed problem.
cheers.
Comments
Post a Comment