Как написать команду для бот-диска в Python для поиска изображений по тегам

Вам нужно установить нижнее ограничение на красное представление, чтобы автомакет мог растянуть ячейку после установки постоянного значения

extension ViewController: UITableViewDataSource, UITableViewDelegate {

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "c", for: indexPath) as! customcell
        configure(cell: cell, indexPath: indexPath)
        cell.redview.backgroundColor = .red
        cell.selectionStyle = .none
        return cell
    }

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let cell = tableView.cellForRow(at: indexPath) as! customcell
        cell.constraint.constant = data[indexPath.row] == "contracted"  ? 30 : 200
        data[indexPath.row] = data[indexPath.row] == "contracted" ? "expanded" : "contracted"
        tableView.reloadData()
    }

    func configure(cell: customcell, indexPath: IndexPath) {
        let data = self.data[indexPath.row]
        if data == "expanded" {
            cell.constraint.constant = 200
        } else {
            cell.constraint.constant = 30
        }

        cell.layoutIfNeeded()
    }
}
0
задан brendonpickens 19 January 2019 в 02:12
поделиться