Как добавить ячейку в UITableViewController с помощью Eureka? - PullRequest
0 голосов
/ 19 мая 2019

Я пытаюсь запрограммировать приложение табличного представления, которое берет данные из формы Eureka и создает ячейки на основе этих данных. У меня возникают проблемы с выяснением, как создать ячейку табличного представления и вставить ее, используя предоставленные пользователем данные из формы. Код ниже.

    +++ Section()
        <<< ButtonRow() { row in
            row.title = "Save Entry"
            }.onCellSelection { (cell,row) in
                self.submit()
    }
}

func submit() {
    self.dismiss(animated: true, completion: {
        var entry = Entry(name: self.name, size: self.size, dateComponents: self.date)
    })
}

Трудно получить данные сверху вниз.

class SneakerTableViewController: UITableViewController {

var entries = Array<Entry>()

@objc func insert() {
    let insertionIndexPath = NSIndexPath(row: entries.count - 1, section: 0)
    tableView.insertRows(at: [insertionIndexPath as IndexPath], with: .automatic)
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return CustomTableViewController.entries.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let customCell = tableView.dequeueReusableCell(withIdentifier: "cellId", for: indexPath) as! CustomCell



    let entry = entries.last

    let dateFormatter: DateFormatter = DateFormatter()
    dateFormatter.dateFormat = "MM/dd/yy"

    customCell.nameLabel.text = entry.name
    customCell.sizeLabel.text = String(format: "%.1f", entry.size)
    customCell.dateLabel.text = dateFormatter.string(from: entry.date)

    customCell.customTableViewController = self

    return customCell
}
}

Спасибо! Любая помощь очень ценится, и, пожалуйста, дайте мне знать, если есть что-то, чем я могу поделиться или ответить, чтобы уточнить!

...