- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我无法让我的 UITableView 退出编辑模式。这是我进入和退出编辑模式的方式,请参阅下面的链接以获取源代码-
进入编辑模式
DbgTableViewHandler.swift(126):
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
...
table.setEditing(true, animated: true);
...
}
离开编辑模式
DbgTableView.swift(105):
func removeCell(_ index : Int) {
...
setEditing(false, animated: true);
...
}
代码
问题
最佳答案
你删除单元格的方式是错误的,你应该使用deleteRows
方式删除它,而不是从dataSource
中删除然后重新加载表,用下面的代码替换它它将起作用
func removeCell(_ index : Int) {
beginUpdates()
myDbgCells.remove(at: index);
let i = IndexPath(row: index, section: 0)
deleteRows(at: [i], with: .automatic)
endUpdates()
//turn mode off (just cause, for demo's sake)
setEditing(false, animated: true);
print("DbgTableView.removeCell(): cell removed");
return;
}
此外,对于如此简单的屏幕,您的项目过于复杂,记住更多代码 = 更难调试
关于ios - UITableView.setEditing() 无法禁用编辑模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48738937/
如果我想将 tableView 置于编辑模式。这样做的正确做法是什么?我似乎可以通过调用 [super setEditing:YES animated:YES] 将 tableView 置于编辑模式是
我想创建此代码:用户输入一个数值,如果输入字符则会抛出异常该字段将停止工作,然后出现另一个框架并显示错误消息用户关闭新框架后,一切恢复原样这意味着该领域将再次发挥作用!我设法使该字段停止工作,但我不知
在我的 UIViewController 中,我有一个 UITableView,它包含不同的单元格,其中包含使用 NSUserDefaults 保存的内容。我还有一个自定义 UIBarButtonIt
我正在开发传统的 iPhone UINavigationController 应用程序,带有自动后退按钮等。 我正在研究按下“编辑”按钮时的情况。左侧后退图标变暗,我的新图标出现,然后一旦我再次点击“
我想重新排列我的表格 View 中的行。我已经实现了这两个方法。 - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIn
我试图通过向右移动标签为红色删除图标创建空间来为自定义 UITableViewCell 的内容设置动画。移动工作正常,但整个文本被截断,这是不应该的,我没有理由这样做,因为有足够的空间。这是编辑状态下
我无法让我的 UITableView 退出编辑模式。这是我进入和退出编辑模式的方式,请参阅下面的链接以获取源代码- 进入编辑模式 DbgTableViewHandler.swift(126):
我使用下面的代码显示使表格变得可编辑,但表格 View 似乎没有在左侧显示删除按钮。为什么? - (void)viewListEditale:(NSNotification *)notific
因此,我在 tableview 中有一个自定义 tableview 单元格,当我使用 [self.tableView setEditing:YES animated:YES]; 代码设置编辑模式时。
我有一个UITableViewCell的子类,添加了UITextField,可以在编辑模式下编辑单元格的内容。 在我的自定义单元实现中,我像这样覆盖了setEditing: -(void)setEdi
我想为表格 View 中的各个单元格添加插入和删除按钮。 以下代码对于删除插入效果很好,我也希望按钮不在导航中。 - (void)viewDidLoad { [super viewDidLoa
我目前已经为我的 TableView 实现了 setEditing/commitEditing 方法,它现在在滑动单元格时显示“删除”按钮。 只是想知道是否有任何方法可以将此按钮上的文本从“删除”更改
我有一个任务是在他出现的时候(比如WhatsApp)立刻显示联系人编辑界面,我用下面的方式显示给他。 @objc private func presentContactEditControlle
选择编辑模式时,我正在使用编辑/完成按钮将MKMapView向上移动,以便在屏幕底部的ImageView中显示消息。我的理解是改变这个按钮的功能我必须使用 override func setEditi
我正在尝试启用拖放 UITableViewCell 来交换它们。这不是问题,但我想在没有“setEditing:”方法的情况下进行。我想在用户使用 longGestureAction 之类的东西拖动单
我在viewDidLoad()下实现navigationItem.leftBarButtonItem = editButtonItem,据说要实现setEditing(_ editing: Bool,
我有一个包含超链接的 JTextPane。当它可编辑时,超链接不可点击,并且光标悬停在它们上时(例如到手)不会改变状态。当它不可编辑时,超链接是可点击的,并且光标悬停在它们上面时会改变状态。完美的。
JTextField.setEnabled() 和 JTextField.setEditable() 有什么区别?在我的代码中,我有一个继承自 JTextField 的类的实例。但是当我设置它的属性
我知道,当我实现 tableView:willBeginEditingRowAtIndexPath: 和 tableView:didEndEditingRowAtIndexPath: 时,滑动删除不会
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 9 年前。 Improve th
我是一名优秀的程序员,十分优秀!