ios - 将按钮添加到显示另一个模态视图控制器的自定义单元格
问题描述
在自定义单元格中,我有一个按钮,我需要以模态方式显示另一个视图控制器。现在,通过 func tableView ... didSelectRowAt通常在点击单元格时显示模态视图,但我们希望通过单元格内的特定按钮来执行此操作。
当前代码:TableViewController
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
if indexPath.section == Section.History.rawValue {
let viewc = UIStoryboard.checkout.instantiateViewController(withIdentifier: DeliverViewController.identifier) as! DeliverViewController
viewc.deliveryId = deliveryArray[indexPath.row].id
viewc.rateDelegate = self
let nc = UINavigationController(rootViewController: viewc)
present(nc, animated: true, completion: nil)
}
}
我想将该动作传递给我的自定义单元类中的 swift 文件中的按钮的 IBAction。谢谢 !!
解决方案
推荐阅读
- python - Python将日期/时间拆分为月、日期、年、时间列
- php - Composer 将依赖项安装到子目录中
- android - setContentView 使用的是非 SDK 接口
- c# - 如何在错误的 API url 上返回 404?(ASP.NET 核心 + SPA)
- sql - 左连接两个表并按两者之间的公共 ID 和所有三个之间的公共 ID 分组
- mysql - 如何在 SQL Server 中使用计数来查找百分比
- dart - Flutter:带有选项的键盘编号未在 Android 设备上显示,仅在模拟器上显示。
- python - 拟合下的神经网络 - 乳腺癌数据集
- javascript - 为反比例编写Javascript
- python - 如何计算大数组中字符串的某些元素?