我正在使用 Visual Studio Community 2017 for Mac。我有一个名为 SchoolSchedule 的 UITableview
。我正在通过按钮设置 Source
,但是当我单击按钮时 GetCell 未被调用,但是,RowsInSection 被调用。
这是我的类(class):
public class ScheduleTableViewSource : UITableViewSource
{
private Schedule[] school;
public ScheduleTableViewSource(Schedule[] school)
{
this.school = school;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = (ScheduleCell) tableView.DequeueReusableCell("cell_id", indexPath);
var school1 = school[indexPath.Row];
cell.Updatecell(school1);
cell.TextLabel.Text = school[indexPath.Row].Site;
return cell;
}
public override nint RowsInSection(UITableView tableview, nint section)
{
return school.Length;
}
}
这是我的按钮代码:
partial void Get_button_TouchUpInside(UIButton sender)
{
bool check = NetworkInterface.GetIsNetworkAvailable();
if(check)
{
Service1 client = new Service1();
var school = client.CypressRidge("CypressRidge");
SchoolSchedule.Source = new ScheduleTableViewSource(school);
SchoolSchedule.ReloadData();
}
else{
Console.Write("Error no Internet connection");
return;
}
// int stop =0;
}
我已经检查过,有数据来 self 的服务。所以这不是问题。谁能帮忙?
最佳答案
我不得不删除表格并创建一个新表格。 Xamarin 中存在错误。
关于c# - 未调用 UITableviewCell GetCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47593229/