作为标题,我需要将数据从JSON传递到我的Home类,但是在两个类之间有一个导航控制器 然后,我想知道如何通过它传递数据。感谢大家的建议。 Storyboard。登录类别:
let title = list["title"] as! String
let description = list["tagline"] as! String
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let navVC = segue.destination as! UINavigationController
let tableVC = navVC.viewControllers.first as! Home
tableVC.title = "Test"
tableVC.description = "Test"
}
家庭控制器:
@IBOutlet weak var titleActivity: UILabel!
@IBOutlet weak var descriptionActivity: UILabel!
var description = ""
var title = ""
override func viewDidLoad() {
super.viewDidLoad()
titleActivity.text = nome //NIL
descriptionActivity.text = descrizione //NIL
}