var savedFaouritePlaces: NSMutableArray = [] //matched strings
Here is the info I get and I want to use this items cell for row at index path
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
guard let cell = tableView.dequeueReusableCell(withIdentifier: "HeartTabCell") as? HeartTabTableViewCell else {
return UITableViewCell()
}
cell.heartTabTitleLabel.text = "Wanna use that title here"
cell.heartTabImageView.image = "wanna use that image here"
return cell
}
答案 0 :(得分:1)
You should use indexPath
to retrieve each dictionary in that array:
let dict = savedFaouritePlaces[indexPath.row]
cell.heartTabTitleLabel.text = dict["Title"]
cell.heartTabImageView.image = UIImage(named: dict["Image"])
答案 1 :(得分:0)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell{
let cell = tableView.dequeueReusableCell(withIdentifier: "HeartTabCell") as? HeartTabTableViewCell
let dictionary = savedFaouritePlaces[indexPath.row]
cell.heartTabTitleLabel.text = dictionary["Title"]
cell.heartTabImageView.image = UIImage(named: dictionary["Image"])
return cell
}