我有一个单元格的表格。内的小区有一个选择器视图传递数据到tableView单元格swift
现在我想从父控制器到表视图细胞传递数据(对象数组),所以我可以显示在选择器视图
数据var foodServings:[FoodUnit]=[]
func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath:NSIndexPath)->UITableViewCell{
let cell = tableView.dequeueReusableCellWithIdentifier("recipeIngredientCell",forIndexPath: indexPath) as! ReceiptIngredientsViewCell
let row = indexPath.row
cell.ingredientName.text = foods[row].name
cell.ingredientText.text = foodQuantities[row]
// cell.foodServings = self.foodServings
return cell
}
我希望我可以发送数据到单元,但这没有奏效。
我尝试clearify这一点:
Thats how the table is constructed
有:
cell.ingredientName.text = foods[row].name
cell.ingredientText.text = foodQuantities[row]
我可以访问例如豆细胞标签和文本中的TextView
但填充选择器视图我需要发送一个数据数组到每个单元格,以便我可以填充选择器视图。
其实你可以和你使用的方式是正确的。你怎么了? –
你做到了这一点,如果是的话,那么你如何将数据传递到tableview单元格 –