Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

numberofowsinsection unreconized selector sent to instance

$
0
0

Hi guys i am getting the above error when I am trying to follow the example of table view source data I am using storyboards though as suppose to xibs. I have placed my code in the viewonload on my dataViewController.cs class

> public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();

        mytable= new UITableView(View.Bounds); // defaults to Plain style
        string[] tableItems = new string[] {"Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers"};
        mytable.NumberOfRowsInSection (1);
        mytable.Source = new TableSource(tableItems);
        Add (mytable);
        // Perform any additional setup after loading the view, typically from a nib.

        // Perform any additional setup after loading the view, typically from a nib.
    }

and my tableviewsource.cs has this

public class TableSource : UITableViewSource { string[] tableItems; string cellIdentifier = "TableCell"; public TableSource (string[] items) { tableItems = items;

    }

    public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
    {
        UITableViewCell cell = tableView.DequeueReusableCell (cellIdentifier);
        // if there are no cells to reuse, create a new one
        if (cell == null)
            cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier);
        cell.TextLabel.Text = tableItems[indexPath.Row];
        return cell;
    }

    public override int RowsInSection (UITableView tableview, int section)
    {
        return 0;
    }

Also with the tableview can somoene show me how to populate the detail pain I have a seguae created ok but need help geting the row click to push to the detail view thanks.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>