ios - Swift 自定义 TableView 尾随动作视图
问题描述
我有TableView
一个trailingSwipeAction
。
这是我的代码:
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let deleteAction = UIContextualAction(style: .destructive, title: "Delete".localized()) {[unowned self] _, _, completionHandler in
let selectedUser = self.friendsDataSourceArray[indexPath.section]
self.friendsDataSourceArray.remove(at: indexPath.section)
let indexSet = IndexSet(arrayLiteral: indexPath.section)
self.theTableView.deleteSections(indexSet, with: .fade)
self.theTableView.reloadData()
DataHandler.removeFriend(friendId: selectedUser.uid)
completionHandler(true)
}
deleteAction.backgroundColor = .redCustom
deleteAction.image = UIImage(systemName: "person.fill.badge.minus")
let configuration = UISwipeActionsConfiguration(actions: [deleteAction])
configuration.performsFirstActionWithFullSwipe = true
return configuration
}
这就是它的样子:
这就是我希望它的样子:
我的有两个问题。
1.没有inset shadow
2.它与我的圆角不对齐cell
。
知道如何实现吗?
解决方案
推荐阅读
- javascript - 如何使用 getUserMedia() 选择要激活的相机以进行条码扫描功能?
- python - 关于 Freecodecamp 练习的 Pandas 数据规范化解释?
- ios - 固定单元宽度 - 无法同时满足约束
- wpf - 如何在鼠标位置放大或缩小时正确同步 WPF Scrollviewer 和 Canvas
- javascript - 使用 console.log 检查时获取 Nan 输出
- python - 修复未绑定的本地错误:分配前的局部变量引用
- mysql - 如何编写正确的 MySQL case 语句
- python - Pandas 无法在 Jupyter 笔记本中使用 xpath 打印从 Web 收集的对象列表
- python - 为什么我不能在 Python(Windows 10)中使用这个字符串 unicodeescape?
- php - 只向媒体添加微小的图像 base64 而不添加任何其他响应式图像?