Как установить несколько UITableview в одном ViewController - PullRequest
0 голосов
/ 11 июня 2019

Я пытаюсь сделать два TableViews в одном ViewController и у меня возникают проблемы с cellForRowAt indexPath

Я пытался var cell:UITableviewCell?, return cell! и теперь let cell = UITableViewCell(), но он все еще не работает

@IBOutlet weak var ButtonA: UIButton!
@IBOutlet weak var ATV: UITableView!

@IBOutlet weak var ButtonB: UIButton!

@IBOutlet weak var BTV: UITableView! 


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = UITableViewCell()

    if tableView == self.ATV {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
        cell.textLabel?.text = Alist[indexPath.row]
        let bgColorView = UIView()
        bgColorView.backgroundColor = UIColor(red:0.93, green:0.60, blue:0.49, alpha:0.5)
        cell.selectedBackgroundView = bgColorView
    }

    if tableView == self.BTV {
        let cell1 = tableView.dequeueReusableCell(withIdentifier: "cell1", for: indexPath)
        cell1.textLabel?.text = Blist[indexPath.row]}

        return cell            
    }

Я хочу, чтобы у каждой кнопки был свой список

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