2012-03-09 71 views
0

我有一個簡單的分組uitableview與導航欄和「編輯」導航欄項目。編輯按鈕只適用於第一部分,表格的其他部分完全不同的東西(想想iPhone設置)。我的問題是刪除表格的這個特定部分的最後一個單元格。每當用戶刪除最後一個單元格時,我將從導航欄中刪除「編輯」按鈕(導致其不再適用)...)。刪除uitableview中的最後一個單元格凍結其他部分

所以我這樣做:

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

..... 

    if ([section count] == 0) { 
     self.navigationItem.rightBarButtonItem = nil; 

..... 
    } 

..... 

} 

的問題是,現在的其他部分都沒有的功能,意義,我不能再點擊他們,他們不反應。我認爲這是因爲我沒有點擊導航欄上的「完成」,因爲刪除最後一個單元格後刪除了它,所以我基本上仍然處於「編輯模式」(不知道我是否在這裏..)。

在任何情況下,我試圖在刪除最後一個單元格後手動調用setEditing:animated:,但這沒有幫助。

參考:

- (void)setEditing:(BOOL)editing animated:(BOOL)animated { 

NSLog(@"****************** entering setEditing:animated"); 

[super setEditing:editing animated:animated]; 
[tblSimpleTable setEditing:editing animated:animated]; 

} 

任何幫助,將不勝感激。謝謝!

回答

0

你試過的UITableView *方法reloadSections:withRowAnimation:

[tblSimpleTable setEditing:editing animated:animated]; 

後?

在iOS 5上正常工作。可能是較低版本的車。

+0

我一直因爲部分墜毀在這條線index..tried很多選擇,沒有什麼工作(一個想法:reloadSections:[indexSetWithIndex的NSIndexSet:段] – TommyG 2012-03-09 20:17:07

+0

嘗試[tblSimpleTable reloadSections:[indexSetWithIndex的NSIndexSet:1] withRowAnimation:UITableViewRowAnimationNone ]。 – velkopopovizky 2012-03-10 18:17:39

相關問題