присутствует UITableViewController дверной ячейки TableViewController? - PullRequest
0 голосов
/ 19 июня 2019

Я хочу SelectRow открыть tableview без раскадровки ??

tableview без раскадровки

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    if indexPath.row == 3 {
        let main = UITableViewController()
        let color = UIColor.yellow
        main.view.backgroundColor = color

        self.present(main, animated: true)

        func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath)


            let name = twoDimensionalArray[indexPath.section][indexPath.row]

            return cell

        }

1 Ответ

0 голосов
/ 19 июня 2019

Вы не должны вкладывать функции

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    if indexPath.row == 3 {
        let main = UITableViewController()
        let color = UIColor.yellow
        main.view.backgroundColor = color

        self.present(main, animated: true)
    }
 }


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

    let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) 

    let name = twoDimensionalArray[indexPath.section][indexPath.row]

    // use name here

    return cell

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