【发布时间】:2015-08-21 06:58:56
【问题描述】:
所以我有一个 SplitView 控制器,当我选择一个我知道如何使用 segue 转到详细视图的单元格时,单元格有城市和州(例如:达拉斯、德克萨斯等)。但是,如何向另一个包含地图的 UIViewController 发送数据?
创建 segue 后,与 SplitView 关联的代码如下所示:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let cell:UITableViewCell = sender as! UITableViewCell
let destinationViewController:ViewController = segue.destinationViewController as! ViewController
// “cell.textLable” is where the value is passed from the SplitView
if let text = cell.textLabel!.text {
let incedent = LocationIncedent(sName: text)
destinationViewController.detailString = "Lat:" + String(stringInterpolationSegment: incedent.incLat) + " Long:" + String(stringInterpolationSegment: incedent.incLong)
DestinationViewController 是标签接受显示值的地方。但是,如何将值发送到地图而不是标签。此外,我需要将纬度和经度坐标传递给 CLLocationCoordinate2D 方法。
谢谢
【问题讨论】:
标签: swift storyboard