I’ve got a segmented control embedded within a TableViewCell:
https://i.stack.imgur.com/4XFML.jpg
It works fine on my iPhone with iOS 4.2, on iPad with iOS 4.2, but on iPad with iOS 3.2 it fails – the segmented control appears disabled. (I don’t know whether the issue appears in iOS 3.1)
Any idea what’s going on? I have “enabled” set to true of course..
Edit
I create the control in IB, so no code for that. I also tried adding a new (fresh) SegmentedControl onto the TableViewCell and it still doesn’t work – so it seems like an issue with a TableViewCell which doesn’t forward taps to the child controls?
The same issue happens when I put a Switch onto the TableViewCell.
As for the code – it’s nothing special:
[[NSBundle mainBundle] loadNibNamed:@"GoalCell"
owner:self options:NULL];
cell = nibLoadedCell;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Goal* g = [self.goals objectAtIndex:indexPath.row];
cell.goal = g;
cell.label.text = g.title;
cell.segment.selectedSegmentIndex = g.priority;
The segmented control was placed directly on the UITableViewCell, while it should’ve been attached as an accessory. After changing this, the problem was solved.