2014-12-03 27 views
3
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)」被標記爲超馳,但發現重寫(CS0115)沒有合適的方法發現重寫RowsInSection xamarin

沒有合適的方法

您好我正在嘗試使用xamarin monotouch創建一個helloworld應用程序,並且我正在接受這個錯誤。有人能幫我解決這個問題嗎?

謝謝

+0

是你的類從UITableViewSource繼承? – Jason 2014-12-03 14:33:57

+0

是它繼承自UITableView – mkayaa93 2014-12-03 14:36:35

+0

不,我問是否繼承自UITableViewSource **。這是RowSelected方法的基類。 – Jason 2014-12-03 14:38:13

回答

11

我的猜測是您使用的是統一API。

在這種情況下,使用這種(的nint代替int):

public override nint RowSelected(UITableView tableView, nint section) 
+0

工作的代碼謝謝 – mkayaa93 2014-12-05 07:37:24

+0

尼斯之一,它內置了:) – 2014-12-11 23:43:08

+0

背後是什麼從int更改它的理由NINT – yashwanth777 2015-01-22 11:38:27

相關問題