在表视图控制器中选择单元格时,在容器视图中显示数据

时间:2017-04-04 14:27:10

标签: ios swift uitableview

我想在容器视图中显示所选国家/地区(在第一个屏幕中突出显示),

以下是我的故事板

enter image description here

这是我在用户在CountryListTableVC中选择国家后所做的事情,但这似乎不起作用。请告知我如何解决这个问题?

http.connection.stalecheck$Boolean=true

这是segue代码:

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

    let indexPath = tableView.indexPathForSelectedRow
    let currentCell = tableView.cellForRow(at: indexPath!) as! CountryTableViewCell

    let countryName         =   currentCell.countryName!.text
    let countryId           =   currentCell.countryId!.text
    let countryDialingCode  =   countryDialingCodes[countryId!]

    var selectedCountryInfo                          = [String: String]();
    selectedCountryInfo["countryName"]               =   countryName
    selectedCountryInfo["countryId"]                 =   countryId
    selectedCountryInfo["countryDialingCode"]        =   countryDialingCode

    performSegue(withIdentifier: "showCountries", sender: selectedCountryInfo)
}

1 个答案:

答案 0 :(得分:0)

这就是你要做的事情:

  1. 右键单击从容器视图拖动到新的导航控制器并选择嵌入
  2. 将导航控制器的根视图控制器设置为userSelectedCountryTVC
  3. 让我知道它是否有效或是否需要帮助。

相关问题