Мне нужно добавить метку в ячейку прототипа, но я получаю сообщение об ошибке "Значение типа 'UITableViewCell' не имеет члена 'movieTitleLabel'.
import UIKit
class FirstTableView: UITableViewController {
let model = MovieModel()
override func viewDidLoad() {
super.viewDidLoad()
}
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return model.MovieArray.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "movieCells", for: indexPath) as! TableViewCell
cell.movieTitleLabel?.text = model.movieArray[indexPath.row]
return cell
}
У меня FirstTableView установлен в качестве делегатаи источник данных в редакторе.
Я создал новый подкласс с именем TableViewCell, связал метку с этим классом. Теперь я в растерянности относительно того, как вывести movieArray на эту метку.