Пользовательская ячейка в смешанном контроллере табличного представления (как подключить розетки?) - PullRequest
0 голосов
/ 25 февраля 2019

У меня есть контроллер табличного представления, который имеет 2 типа ячеек.Статическая ячейка и динамическая ячейка.Первая строка зарезервирована для 1 статической ячейки, а вторая - для динамической.

Это мой код внутри контроллера табличного представления

class AddCompanyTableVC: UITableViewController {


var dataSource: [String] = ["123","123"]

override func viewDidLoad() {
    super.viewDidLoad()
    tableView.register(CompanyCell.self, forCellReuseIdentifier: "CompanyCells")

}


override func numberOfSections(in tableView: UITableView) -> Int {
    return 2
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    if section == 1 {
        return 2
    }
    return super.tableView(tableView, numberOfRowsInSection: section)
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    if indexPath.section == 1 {
        let cell = tableView.dequeueReusableCell(withIdentifier: "CompanyCells", for: indexPath) as! CompanyCell

        return cell
    }
    return super.tableView(tableView, cellForRowAt: indexPath)
}

override func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int {
    if indexPath.section == 1 {
        let newIndexPath = IndexPath(row: 0, section: indexPath.section)
        return super.tableView(tableView, indentationLevelForRowAt: newIndexPath)
    }
    return super.tableView(tableView, indentationLevelForRowAt: indexPath)
}

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    if indexPath.section == 1 {
        return 100
    }
    return super.tableView(tableView, heightForRowAt: indexPath)
}}

И это код, который я хочу использовать для динамической ячейки

class CompanyCell: UITableViewCell {

override func awakeFromNib() {
    super.awakeFromNib()
    // Initialization code
}

override func setSelected(_ selected: Bool, animated: Bool) {
    super.setSelected(selected, animated: animated)

    // Configure the view for the selected state
}}

Проблема в том, что я не могуподключите розетку от раскадровки к CompanyCell.Я проверил, настроил ли я все в раскадровке.Класс динамической ячейки - CompanyCell, а класс контроллера табличного представления - AddCompanyTableVC.Любая идея, как я могу подключить розетки?Я хочу использовать 4 метки в моей динамической ячейке.

РЕДАКТИРОВАТЬ Вот экран из раскадровок.enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...