如何为双数组中的值的segue索引做准备

时间:2015-03-31 16:18:27

标签: ios swift segue

所以我在第一个控制器中有这个代码。

var countries = ["American", "Asian", "Italian"]
var items = [["Mcdonalds", "BurgerKing", "Big Boy"], ["PFChangs", "China One Buffet"], ["Pizza House", "Pizza Hit", "Olive Garden", "Maggianos"]]

 if (segue.identifier == "segueone")
{
    let cellIndexPath = self.tableView!.indexPathForCell(sender as UITableViewCell)
    if  let unwrappedCellindexPath = cellIndexPath
    {
        var nextVC = (segue.destinationViewController as TableTwo)
        nextVC.items = items[unwrappedCellindexPath.row]
    }
}
}

在第二个表控制器上我有

var items: [String]?

我期待进一步处理。我想将双数组中的一个特定值转换为第三个控制器。我知道我的代码不会有太大的不同,但我不确定如何从我的第二个控制器中的双数组发送特定索引到第三个控制器?

1 个答案:

答案 0 :(得分:0)

您要传递索引还是项目? 要传递你想写的项目

nextVC.item = items[unwrappedCellindexPath.row][index2]