c# - 未调用 UITableviewCell GetCell

标签 c# ios uitableview xamarin

我正在使用 Visual Studio Community 2017 for Mac。我有一个名为 SchoolScheduleUITableview。我正在通过按钮设置 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/

相关文章:

c# - 如何确定 C# 应用程序中的空闲时间?

c# - 我应该如何使用 xamarin 表单在 android 上创建主要 Activity 以支持画中画模式?

iOS 在 UITableViewCell 中均匀间隔 5 个标签

ios - 页面 View Controller 中的页面突然下拉 Action

c# - 如何确保我们的 .NET Core API 清理数据库连接?

c# - 在 C# 中从 Windows 访问 iOs 文件系统

objective-c - 在提交之前使用 Singleton 来跟踪表单数据。 . .好主意?

ios - TableView reloadData 不会更新 iPad 中的 UI,但适用于 iPhone

ios - 使用 swift 在运行时添加/删除 UITableView 中的部分

ios - 可将表格菜单扩展到 Xcode 中的新 View Controller