UITableView编辑不起作用
|
我有一个UITableView,它位于弹出窗口中的NavigationController中。因此,我放置了一个可以正常工作的edit / done UIToolBarItem,您可以看到显示的删除附件图标。但是,当我重新排列项目时,“编辑/完成”按钮将停止工作...
我进行了调试,但仍然可以调用它,但它似乎没有更新,并且可以防止其他按钮进行任何进一步的更新。模拟器可能有问题吗?
我在这里先向您的帮助表示感谢!
编辑:添加代码
addButton = [[UIBarButtonItem alloc] initWithTitle:@\"Edit\" style:UIBarButtonItemStyleBordered target:self action:@selector(editTable:)];
然后在方法上:
- (IBAction) editTable: (id) sender
{
if ([[addButton title] isEqualToString:EDIT_STRING]) {
[addButton setTitle:DONE_STRING]; //enabling edit mode
[super setEditing:YES animated:YES];
[[self tableView] setEditing:YES animated:YES];
}
else {
[addButton setTitle:EDIT_STRING]; //done with editing
[[self tableView] setEditing:NO animated:YES];
[super setEditing:NO animated:YES];
[[self tableView] setNeedsDisplay];
[[self tableView] reloadData];
}
}
第二部分肯定会随着addButton文本的更改而调用。但是,一旦我进行了修改(例如重新安排一行),它就会停止工作
没有找到相关结果
已邀请:
2 个回复
桑娠贯涤
徐百晴墓斜