ios - UITableView 滑动自定义按钮消失
问题描述
UITableViewCell
触发滑动操作时,我的自定义有问题。我的单元格中有 a UIStepper
、UILabel
s 和 a UIImage
,但是当我滑动时,只有UIStepper
元素消失了。完成/取消滑动动作时,会UIStepper
在短时间内重新出现。请看附件gif:
这是实现滑动动作的代码:
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
let deleteAction = UIContextualAction(style: .destructive, title: "Delete") { (action, view, handler) in
print("Delete Action Tapped")
}
let editAction = UIContextualAction(style: .destructive, title: "Edit") { (action, view, handler) in
print("Add Action Tapped")
}
editAction.backgroundColor = .orange
deleteAction.backgroundColor = .red
let configuration = UISwipeActionsConfiguration(actions: [deleteAction, editAction])
return configuration
}
使用适用于 iOS 12 的 Swift 4.2 和 Xcode 10。任何帮助将不胜感激!
解决方案
推荐阅读
- javascript - CSP 阻止了在 data:application/javascript;base64,KGZ1b...(“script-src”)处加载资源
- vba - 范围类的复制方法从外部工作簿复制数据失败
- ruby-on-rails - 更新 Braintree 交易的订单 ID
- spring-mvc - 存在可选的 int 参数“rating”,但由于被声明为原始类型,因此无法转换为 null 值
- asp.net-core - AspNet Core 脚手架应用程序中的登录和注册页面在哪里?
- javascript - 单击时与从另一个文件导入的元素交互
- javascript - Vue.js 组件导航活动类仅适用于第二次点击
- sql-server - 用于查找匹配短语的 SELECT 语句
- c# - 映射网络驱动器 Windows 服务
- php - 更大的多维数组上的 Foreach 循环