2010-08-03 111 views
0

我在iPhone中有一個表格編輯功能。我在我的項目中使用委託和數據源。 問題是,當我們點擊刪除披露,我沒有得到刪除按鈕。 我是iPhone編程的新手。所以請幫助我。 在此先感謝。Iphone中的表格行刪除

回答

2

您需要實現的方法

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return UITableViewCellEditingStyleDelete; 
}  

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 

您還需要確保tblView.editing屬性設置爲true;

+0

我實現了這兩個方法。我可以點擊紅色的刪除按鈕。但點擊我沒有得到DELETE按鈕在右側。 感謝您的回覆Criss。 – santosh 2010-08-03 18:47:09

+0

你將不得不向我展示一些代碼,然後因爲這是我實現的並且我已經工作了。所以發佈你的代碼,我會比較它到我的。 – 2010-08-03 19:05:56

+0

對不起,現在我沒有任何代碼與我。明天我會發布我的代碼。 – santosh 2010-08-03 19:18:19