【发布时间】:2011-03-19 21:38:19
【问题描述】:
我有一个 UIViewController 类,带有一个 tableView。在 viewDidLoad 中:
UIBarButtonItem *editIcon = [[[UIBarButtonItem alloc]
initWithBarButtonSystemItem: UIBarButtonSystemItemEdit
target:self
action:@selector(toggleEditMode)] autorelease];
在方法'toggleEditMode'中:
-(void)toggleEditMode{
if(self.theTable.editing) {
[theTable setEditing:NO animated:YES];
[self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStylePlain];
}
else if ([callsArray count]!=0){
[theTable setEditing:YES animated:YES];
[self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone];
}
}
问题在于“编辑”按钮不会更改为“完成”。少了什么东西?我已经声明了所有方法:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
谢谢,
强化学习
【问题讨论】:
标签: iphone uitableview editmode