找不到合适的方法来覆盖RowsInSection xamarin

mka*_*a93 3 uitableview xamarin.ios ios 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;
        }
    }
Run Code Online (Sandbox Code Playgroud)

`Helloworld_iOS.CallHistoryController.CallHistoryDataSource.RowSelected(UIKit.UITableView,int)'被标记为覆盖但没有找到合适的方法来覆盖(CS0115)

嗨,我正在尝试用xamarin monotouch制作一个helloworld应用程序,我正在接受这个错误.任何人都可以帮我解决这个问题吗?

谢谢

Rol*_*nge 11

我的猜测是你正在使用Unified API.

在这种情况下使用此(nint而不是int):

public override nint RowSelected(UITableView tableView, nint section)
Run Code Online (Sandbox Code Playgroud)