我的代码有一个很大的问题。我的问题是,我怎样才能从用户点击到详细视图控制器的tableviewcell数据。PrepareForSegue with UITableViewController - 传递数据
我已经从数组中取出数据并将其显示在我的tableviewcontroller中,但是如何使用prepareForSegue将该数据传递给新的viewcontroller?
这是我在单元格中显示数据的代码。
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
// Table view cells are reused and should be dequeued using a cell identifier.
let cellIdentifier = "MealTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! MealTableViewCell
// Fetches the appropriate meal for the data source layout.
let meal = meals[indexPath.row]
cell.nameLabel.text = meal.name
cell.photoImageView.image = meal.photo
cell.descriptionLabel.text = meal.description
cell.servedWithLabel.text = meal.servedWith
return cell
}
的问题是,调用prepareForSegue的那个以外意味着我不能使用例如meal.name将名字传下去通过对细节视图 - 控制?该怎么办?
希望你们能帮助我 - 我一直在这个挣扎了一段时间:-(
很好,谢谢你帮助我! –