Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no suitable method found to override RowsInSection xamarin

   class CallHistoryDataSource : UITableViewSource
    {
        CallHistoryController controller;

        public CallHistoryDataSource (CallHistoryController controller)
        {
            this.controller = controller;
        }

        public override int RowSelected(UITableView tableView, int section)
        {
            return controller.PhoneNumbers.Count;
        }
        //
        // Returns a table cell for the row indicated by row property of the NSIndexPath
        // This method is called multiple times to populate each row of the table.
        // The method automatically uses cells that have scrolled off the screen or creates new ones as necessary.
        //
        public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.DequeueReusableCell (CallHistoryController.callHistoryCellId);

            int row = indexPath.Row;
            cell.TextLabel.Text = controller.PhoneNumbers [row];
            return cell;
        }
    }

`Helloworld_iOS.CallHistoryController.CallHistoryDataSource.RowSelected(UIKit.UITableView, int)' is marked as an override but no suitable method found to override (CS0115)

Hi I'm trying to make a helloworld application with xamarin monotouch and I'm taking this error.Can anybody help me about this?

Thank you

like image 955
mkayaa93 Avatar asked Nov 25 '25 20:11

mkayaa93


1 Answers

My guess is that you're using the Unified API.

In which case use this (nint instead of int):

public override nint RowSelected(UITableView tableView, nint section)
like image 194
Rolf Bjarne Kvinge Avatar answered Nov 28 '25 13:11

Rolf Bjarne Kvinge



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!