导航控制器上的编辑按钮未进入编辑模式
我有一个 UIToolbar,上面有一个编辑栏按钮。这被定义为
self.toolbarItems = [NSArray arrayWithObjects:self.editButtonItem,nil];
编辑栏项目显示,但是当我点击它时,没有任何反应,它不会更改为“完成”,并且没有任何编辑控件显示。
我已经实现了以下方法,因为我希望能够点击一个单元格并显示一个视图来编辑该单元格的值。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.editing) {
NSLog(@"editing ON in didSelect...");
}else{
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animate {
if (editing) {
NSLog(@"editing ON in setEditing");
}else {
NSLog(@"not editing in setEditing");
}
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
是什么导致编辑按钮无法正常工作?
谢谢。
I have a UIToolbar with an edit bar button on it. This is defined as
self.toolbarItems = [NSArray arrayWithObjects:self.editButtonItem,nil];
The edit bar item shows up, and but when i tap it, nothing happens, it does not change to Done and none of the editing controls show up.
I have implemented the following methods as i would like to be able to tap a cell and display a view to edit that cell's value.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.editing) {
NSLog(@"editing ON in didSelect...");
}else{
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animate {
if (editing) {
NSLog(@"editing ON in setEditing");
}else {
NSLog(@"not editing in setEditing");
}
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
What is causing the edit button to function incorrectly?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 self.editButtonItem 只应该像 UINavigationControllers 中那样自动工作,而不是工具栏。如
self.navigationItem.rightButton = self.editButton;
I think
self.editButtonItem
is only supposed to work automatically like that in UINavigationControllers, not toolbars. As inself.navigationItem.rightButton = self.editButton;