ios - 在两个 View Controller 之间传递mapkit数据

标签 ios swift xcode swift3 mapkit

我有两个 View Controller 。其中之一是搜索 View Controller ,它使用 Mapkit 来允许用户搜索位置。 enter image description here

我希望能够单击特定的单元格,然后将该单元格的副标题分配给另一个 View Controller 中的文本字段。有谁知道如何做到这一点? enter image description here

最佳答案

您可以实现以下UITableViewDelegate方法。

   func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

        tableView.deselectRow(at: indexPath, animated: false)

        let cell = tableView.cellForRow(at: indexPath) as! MyCell
        let vc = MyViewController()
        vc.subtitle = cell.subTitle.text
        present(vc, animated: true, completion: nil)
    }

关于ios - 在两个 View Controller 之间传递mapkit数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44754858/

相关文章:

swift - SceneKit - 运动 + 重力 = 奇怪的运动

ios - 为什么我的 if string == else if != 语句只适用于数组中的最后一个值?

ios - 如何在 UIPicker 中首先选择具有特定标题的数组

swift - 在后台线程上启动 `CLLocationManager` 是否明智?

swift - UICollectionViewDelegateFlowLayout 方法未在 Swift 2.3 App 中调用

ios - 将 PinTintColor 调整为 mapkit 的 Ray Wenderlich 教程

xcode - OSX 列表组件 Objective-C

xcode - Git、XIB、 merge

ios - 重新加载/滚动表格时标签消失

ios - 未在所有 uitableviewcells 上绘制线