Override prepareForSegue
and set whatever value on the tableview you'd like. You can grab the tableview from the UINavigation
viewControllers
property.
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!){
let navVC = segue.destinationViewController as UINavigationController
let tableVC = navVC.viewControllers.first as YourTableViewControllerClass
tableVC.yourTableViewArray = localArrayValue
}
For Swift 3 :
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let navVC = segue.destination as? UINavigationController
let tableVC = navVC?.viewControllers.first as! YourTableViewControllerClass
tableVC.yourTableViewArray = localArrayValue
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…