2011-03-18 125 views
0

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

有什么代码,使你的表格单元格看起来像?他们如何摆放? – occulus 2011-03-18 17:04:33

+0

连接和单元格:http://web.me.com/gguglielmo/Q/Q1.html – sambaMan 2011-03-18 17:53:36

+0

你有没有想过这里发生了什么? – Rohan 2013-06-14 18:41:46

回答

0

仔细检查你的有线起来,你都表的UITableViewDelegateUITableViewDataSource正确地编写了新的UIViewController。

+0

连接和单元格布局(位于web.me.com/gguglielmo/Q/Q1.html)显示文件所有者的数据源和代理的插座已连接到表视图。表单元格很简单(并且没有改变)。 – sambaMan 2011-03-18 18:05:50

0

确保cell.editingAccessoryView设为零在:

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { 
cell.editingAccessoryView = nil; 
} 
0

你没有实现的tableView协议在您的.H ..你的类接口应该是这样的

@interface RootViewController : UIViewController <NSFetchedResultsControllerDelegate, UITableViewDelegate,UITableViewDataSource> 
相关问题