- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我想让用户能够在我执行删除滑动操作时删除表格单元格,但我不知道如何实际删除所选单元格!如您所知,我正在使用 Swift 和 Xcode 6.3.1 编程
var deleteAction = UITableViewRowAction(style: .Default, title: "Delete") { (action, indexPath) -> Void in
tableView.editing = false
println("deleteAction")
}
这也是 Dropbox 的屏幕截图:Screenshot Of Delete Swipe Action
最佳答案
如果你想从 tableView 中完全删除一个单元格,那么你也必须将它从你的表数组中删除。考虑以下代码:
var deleteAction = UITableViewRowAction(style: .Default, title: "Delete") { (action, indexPath) -> Void in
tableView.editing = true
// Remove it from your TableArray and If it is stored into any local storage then you have to remove it from there too because if you doesn't remove it from your local storage then when you reload your tableview it will appears back
self.tableData.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Automatic)
}
return [deleteAction]
}
关于UITableViewRowAction : Delete,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30681559/
我想让用户能够在我执行删除滑动操作时删除表格单元格,但我不知道如何实际删除所选单元格!如您所知,我正在使用 Swift 和 Xcode 6.3.1 编程 var deleteAction = UITa
我有下面的代码,它将处理 tableViewCell 中的右侧滑动,当用户在具有discussionURL的正确单元格上向右滑动时,如果用户在没有这个内容的单元格上向右滑动,它工作正常URL 然后 U
当 UITableViewRowAction 滑动发生时,与该操作关联的单元格背景会将其背景颜色更改为白色,而不是像通常那样的黑色。换句话说,您可以在单元格圆角半径后面看到的颜色随着滑动操作而变化。请
使用UITableViewRowAction非常棒。有件事让我烦恼,我想保留原始单元格 textLabel 的一部分,以便我亲爱的用户知道他们要删除的内容。 通过使用UITableViewRowAct
我用谷歌搜索了两个多小时,没有发现任何有用的东西:我有一个带有 editActions 的 tableView 。当我按下该操作时,我会显示一个包含附加信息/需要确认的警报 Controller 。
func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyO
我已经创建了自定义操作: public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndex
我在 中创建了一个 UITableViewRowAction 的实例 -(NSArray *)tableView:(UITableView *)tableView editActionsForRow
我正在使用 UITableViewRowAction iOS 8 Beta 2+ 中的方法在我的表格中的一行上滑动时添加自定义按钮。我不知道如何处理点击事件,它目前只是让我的应用程序崩溃了。我尝试了以
使用 UITableViewRowAction 可以在每一行上设置不同数量的按钮吗?例如,我希望一行包含 3 个操作,其余行包含 2 个操作。这可能吗? func tableView(tableVie
我的源代码中有 3 个 UITableViewRowAction 的,如下所示: - (NSArray *)tableView:(UITableView *)tableView
我想编辑表格的 UITableViewRowAction。我的单元格有圆边和边框,我想编辑 RowAction 的样式以匹配我的单元格的样式。 据我所知,目前只有 backgroundColor、标题
我想做一个像邮件应用一样的 cell 滑动 Action 。 我将 UIImage 设置为行操作的 backgroundColor。 action.backgroundColor = [UIColo
我有一个 UITableView,我使用 UITableViewDelegate 和 UITableViewDataSource 在 Controller 中进行管理。在此表中,我有一个自定义单元格,
那里有几个类似的问题,但我认为应该有一个最新的 iOS 10 答案,使用 Swift3,不使用私有(private) API,也不依赖于你限制你的图标到 unicode 表情符号。 我现在有包含三个操
我想在 Swift 的 tableviewCell 的滑动 Action 中放置图标(图像)而不是文本。 但我不知道如何用图片代替标题文字? 我的代码如下: func tableView(tableV
我有一个自定义的 UITableViewRowAction 设置和工作。我唯一无法解决的是如何在选择了一个 Action 后关闭 UITableViewRowAction。我确定我错过了一些非常明显的
我使用objective-c 编程iPhone App。版本在 iOS 8.1 之后。我的 UITableViewCell 中有一些 UITableViewRowAction,我在点击其中一个 UIT
这个问题已经有答案了: How to change UITableViewRowAction title color? (11 个回答) 已关闭 7 年前。 我想更改 UITableViewRowAc
我已经使用 UITableViewRowAction 创建了 UITableView:编辑和删除。当按下删除键时,确认应该显示为 UIAlertController。如果用户按删除,单元格应被删除,如
我是一名优秀的程序员,十分优秀!