UITableViewCell detailTextLabel area not allowing selection of cell
Inside a UITableViewCell, the area covered by detailTextLabel doesn't
recognise selection of the cell.
The cell style is UITableViewCellStyleSubtitle
The entire bottom area of the cell is not selectable and users are
sometimes tapping the cell multiple times before tapping high enough on
the cell for it to detect the touch.
I've tried [[myCell detailTextLabel] setUserInteractionEnabled:NO] or
setting background colour to clear which has helped in similar cases, what
else can I do?
I thought about adding a UILabel as a subview of the cell instead of
detailTextLabel which I will try if I can't find the answer here.
EDIT - as requested
Here is the code from cellForRowAtIndexPath
NSString *cellId = @"cell";
locationsCell = [tableView dequeueReusableCellWithIdentifier:cellId];
if(locationsCell == nil) {
locationsCell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:cellId];
}
[[locationsCell textLabel] setFont:[UIFont fontWithName:@"Optima-Bold"
size:18]];
[[locationsCell textLabel] setText:@"Choose your location"];
[[locationsCell detailTextLabel] setFont:[UIFont
fontWithName:@"Optima" size:14]];
[[locationsCell detailTextLabel] setText:@"Tap to select"];
[[locationsCell detailTextLabel] setBackgroundColor:[UIColor
clearColor]];
return locationsCell;
EDIT Sorry I've messed up. I had set a footer view for another table and
it has added a clear footer view that made the cell un-selectable instead
of adding a conditional for the two tables. I removed the footer and it's
working.
No comments:
Post a Comment