0
我正在使用google地方api提供建議的搜索。所以它搜索每個字符命中的api。我有一個表格源更新。 這裏是GetCell方法在Xamarin ios中創建Ucellsource getcell方法中的單元格時出現異常
public override UITableViewCell GetCell(UITableView tableView,NSIndexPathindexPath)
{
var cell = base.GetCell(tableView, indexPath) as CityCell;
cell.SubscriteToCheckEvent(() =>
{
var ddd = cell as CityCell;
viewModel.ZipCode = cell.CityNameText.Text;
viewModel.SearchStoresCommand.Execute(true);
});
return cell;
}
我得到當我試圖更新值快速
Index was out of range. Must be non-negative and less than the size of the collection.
有什麼辦法,我能避免這種異常的異常?
任何建議都會有幫助。
什麼是基類?通常情況下,除非您的基地是由您創建的另一個班級,否則不要調用'base.GetCell'。如果你不是從你自己的類繼承,那麼你應該調用'tableView.DequeueReusableCell'來獲取單元格。 –