表视图包含在常规视图中。
正如预期的那样,录制“编辑”按钮(在该表格视图中)为每一行显示“带有减号的红点”(即,方法'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