UITableviewCell GetCell is not being called

I am using Visual Studio Community 2017 for Mac. I have a UITableview named SchoolSchedule. I am setting the Source from a button, but then when I click the button GetCell is not called, however, RowsInSection is called. Here is my 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;
    }



}

here is my button code :

 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;

    }

I have checked and there is data coming in from my service. so that is not the problem. can anyone help?

I had to deleted the table and make a new one. there a bug in Xamarin.

Custom UITableViewSource GetCell method not being called , Count; } public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { // request a recycled cell to save memory  The GetCell method in the data source class for a UICollectionView is not getting called if there is only a single item in the collection and the size set in the LineLayout class is greater than 35.0f or the ACTIVE_DISTANCE is > 151. This is only in iOS 6.0 or 6.1, works as expected in iOS 7.

I had the same problem and I managed to fix it setting up Identifier property of TableView first prototype row - in storyboard

UITableViewDataSource.GetCell(UITableView, NSIndexPath , If RegisterClassForCellReuse(Type, String) or RegisterNibForCellReuse(UINib, String) have not been called during initialization, application developers must  The UITableView uses the GetCell method of the UITableViewDataSource delegate to create or reuse instances of cells as they become visible on screen. Great, that sounds efficient, and it is! However, in my application the GetCell method was being called once for every cell when the UITableView was initialized, including the invisible ones.

In addition to implementing the IUITableViewDelegate and IUITableViewDataSource interfaces in the .cs file, calling RegisterNibForCellReuse, and assigning the table view's EstimatedRowHeight, it's easy to forget to set the data source and delegate properties of the table view in the XIB.

UITableviewCell GetCell is not being called, UITableviewCell GetCell is not being called. I am using Visual Studio Community 2017 for Mac. I have a UITableview named SchoolSchedule. I am setting the  I have am creating custom cells for my TableView. I have 8 different kinds of cells. This is happening for all the cells but I will pick one for this example to demonstrate what is going on. My cell NumberCell has a TextField in it. Below you can see how I setup the cell with GetCell and SetupDelegates.

Xamarin iOS UITableView GetCell Method Called for Invisible Cells, Xamarin UITableView was calling the UITableViewDataSource "GetCell" However, in my application the GetCell method was being called once for The EstimatedRowHeight property was not set, effectively relying on the  If RegisterClassForCellReuse(Type, String) or RegisterNibForCellReuse(UINib, String) have not been called during initialization, application developers must check the result of DequeueReusableCell(String, NSIndexPath) for null and instantiate a new UITableViewCell as necessary).

Working with UITableView (Xamarin.iOS), Not so simple in iOS. There's a nice Xamarin has a nice guide that I used for guidance (Working with Tables and Cells). Coming public override UITableViewCell GetCell( UITableView tableView, NSIndexPath indexPath ). Since the GetCell (UITableView, NSIndexPath) method will be called whenever a cell comes into view, application developers should avoid unnecessary computation. The UITableView 's reuse queue is accessed via the DequeueReusableCell (String, NSIndexPath) method, which takes a string identifying the type of UITableViewCell to retrieve.

IOS 8 for Programmers: An App-driven Approach with Swift, After the Model is created, line 48 calls the Model's synchronize method, which If the UITableView is not in editing mode, line 61 gets the UITableViewCell on tableView.editing { 61 let cell = sender.view as UITableViewCell // get cell 62 63 

Comments
  • the getCell is not called because when you click a button, the method that is called is RowSelected in a UITableView. This is the method called when occur a selection or action in a specific cell in UITableView.
  • So do I have to override RowSelected ?
  • yes you need to override RowSelected
  • What number does the RowsInSection method return? are you sure your data is available before the RowsInSection call?
  • yes I use the debugger and I can see the data and it is return 25
  • How did you make it?