【发布时间】:2018-03-14 06:29:43
【问题描述】:
我在UITableView 中添加了一个原型单元格,其中包含一个UISwitch 和一个UILabel。当我运行应用程序时,UISwitch 和 UILabel 显示正常,但有些我无法与 UISwitch 交互。我无法在开或关之间切换。
我也尝试过创建一个单独的 UITableViewCell 并实现相同的 UI。我还是有同样的问题。
我正在为 Cell 充气如下:-
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);
}
编辑
整个单元格也没有被点击。如果我只添加一个没有 UISwitch 的标签,则单元格点击工作正常。
【问题讨论】:
-
您是否设置了诸如 tableView.allowsSelection = false 之类的属性?
-
@Bharath 不。我没有设置类似的东西
-
@Bharath 请检查我的编辑
-
除了开关和标签之外,单元格中是否还有其他 UIElements,如果单元格上有任何其他 ui 元素,则它可能不允许以下内容的操作。
-
@Bharath 我没有其他元素
标签: ios uitableview xamarin.ios uiswitch user-interaction