0
我有一個視圖,它有它自己的導航欄和一個tableview。我想在該表格視圖中編輯&刪除項目。我已經在導航欄上放置並編輯按鈕。使用自定義導航項在tableview中編輯
self.navItem.leftBarButtonItem = self.editButtonItem;
也有這樣的一種方法。
- (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if(editingStyle == UITableViewCellEditingStyleDelete) {
//Get the object to delete from the array.
//Delete the object from the table.
[self.tblView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
但是當我點擊該按鈕,沒有在tableview中的項目轉向與紅色標記圖標。只是編輯按鈕的標題更改爲「完成」。
應該是什麼問題?
是的我在UIVIewController中放置了一個UITableView。還有一個導航欄。所以,如果可能的話,請你詳細解釋一下這個例子。 – 2009-10-24 06:06:10