I'm having an issue trying to load an array of images into a UITableView with a prototype cell in another view controller.
I didn't seem to get an answer from swift 3 error : Argument labels '(_:)' do not match any available overloads as I am pretty new and couldn't derive the explanation from the answers.
I am receiving the error in the title from:
let portraitsOfHeroes:[UIImage] = UIImage(named: "picture1", "picture2", "picture3")
while trying to make an array of images with (portraitsOfHeroes):
import UIKit
class NewHeroVC: UIViewController, UITableViewDataSource {
let listOfHeroes:[String] = ["Name1", "Name2", "Name3"]
let portraitsOfHeroes:[UIImage] = UIImage(named: "picture1", "picture2", "picture3")
and use them through (cell.newHeroPortrait.image):
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "heroCell", for: indexPath) as! NewHeroCell
cell.newHeroName.text = listOfHeroes[indexPath.row]
cell.newHeroPortrait.image = portraitsOfHeroes[indexPath.row]
return cell
}
What's the reason it's returning the error on my array?