diff options
Diffstat (limited to '')
-rw-r--r-- | foray/ForayTableViewController.swift | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift index 8f11285..6a0baa1 100644 --- a/foray/ForayTableViewController.swift +++ b/foray/ForayTableViewController.swift @@ -55,6 +55,8 @@ class ForayTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() + tableView.rowHeight = UITableView.automaticDimension + // Register our custom cell tableView.register(ForayNewTableViewCell.self, forCellReuseIdentifier: "ForayNewTableViewCell") @@ -153,21 +155,19 @@ class ForayTableViewController: UITableViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let item = self.sections[indexPath.section].items[indexPath.row] -// let cell: ForayTableViewCell -// switch item.type { -// case .item: -// cell = tableView.dequeueReusableCell(withIdentifier: "ForayCell", for: indexPath) as! ForayTableViewCell -// cell.cellItemImage?.image = UIImage(named: item.id) -// case .quest: -// cell = tableView.dequeueReusableCell(withIdentifier: "ForayQuestCell", for: indexPath) as! ForayTableViewCell -// } -// -// cell.cellItemName?.text = item.name -// cell.cellItemSubtitle?.text = "ID: " + item.id + let type: String + let icon: UIImage + switch item.type { + case .item: + type = "Item" + icon = UIImage(named: item.id)! + case .quest: + type = "Quest" + icon = UIImage(named: "spy")! + } let cell: ForayNewTableViewCell = tableView.dequeueReusableCell(withIdentifier: "ForayNewTableViewCell", for: indexPath) as! ForayNewTableViewCell - cell.setData(str: item.name) - + cell.setData(name: item.name, desc: type + "ID: " + item.id, img: icon) return cell } |