表視圖包含在常規視圖中。
正如預期的那樣,錄製「編輯」按鈕(在該表格視圖中)爲每一行顯示「帶有減號的紅點」(即,方法'setEditing'執行OK)。
但是,單擊這樣的紅點不會顯示相應的「刪除」按鈕('commitEditingStyle'不會執行)。
任何想法可能是錯誤的(請參閱下面的相關代碼)?編輯UITableView時,單擊紅點不能顯示'刪除'按鈕
//---- RootViewController.h ----
@interface RootViewController : UIViewController <NSFetchedResultsControllerDelegate> { //used to be a 'UITableViewController'. Changed to UIViewController and rewired so I could add an iAd banner and the tableView to it. Before that change, issue was not present (commitEditingStyle below used to work).
...
}
@property (nonatomic, retain) IBOutlet UITableView *tableView;
//----- RootViewController.m ----
- (void)viewDidLoad {
self.navigationItem.leftBarButtonItem = self.editButtonItem;
...
}
- (void) setEditing:(BOOL)editing animated:(BOOL)animated { //Added so clicking 'Edit' displays red dots that rotate on tap (as expected).
[super setEditing:editing animated:animated];
[self.tableView setEditing:editing animated:animated];
if (editing) {
NSLog(@"RootViewController setEditing"); //Executes OK.
}
}
- (void)tableView:(UITableView *)tableView //Clicking a red dot no longer executes this method (so, does not display 'Delete' red button).
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"RootViewController commitEditingStyle"); //Does NOT execute.
...
}
有什麼代碼,使你的表格單元格看起來像?他們如何擺放? – occulus 2011-03-18 17:04:33
連接和單元格:http://web.me.com/gguglielmo/Q/Q1.html – sambaMan 2011-03-18 17:53:36
你有沒有想過這裏發生了什麼? – Rohan 2013-06-14 18:41:46