I have added a Prototype cell to my UITableView which has a UISwitch and an UILabel. When I run the app the UISwitch and UILabel display fine as expected, but some how I can not interact with the UISwitch. I can not toggle it between On or Off.
I have also tried creating a separate UITableViewCell and implementing the same UI. Still I have the same issue.
I am inflating the Cell as follows :-
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
RatingTableCell cell = tableView.DequeueReusableCell("RatingTableCell") as RatingTableCell;
if (choiceList != null && choiceList.Count > 0)
{
cell.UpdateCellchoiceList.ElementAt(indexPath.Row));
}
else
{
//Do something else
}
return cell;
}
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
var cell = tableView.CellAt(indexPath);
}
EDIT
The whole cell is also not getting clicked. If I just add a label without the UISwitch the cell click works fine.

In case someone comes to this post like me, this might be helpful. If your UISwitch is added manually to the UITableViewCell, make sure it's added to the contentView of the cell. The UISwitch will not work if it's added like addSubview(switch), you need to do contentView.addSubview(switch) instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With