aboutsummaryrefslogtreecommitdiff
path: root/foray/ForayTableViewController.swift
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-03-18 14:48:57 +1100
committerNicholas Tay <nick@windblume.net>2022-03-18 14:49:54 +1100
commita44529a1c62ba58ed09c029f2a0f9c9e36099f21 (patch)
tree5461ed40281b28fe7a58f822083c484a3143a0f1 /foray/ForayTableViewController.swift
parentf45d90ba504496e68d6a4cb2f7f887c011e9b19d (diff)
downloadforayios-a44529a1c62ba58ed09c029f2a0f9c9e36099f21.tar.gz
forayios-a44529a1c62ba58ed09c029f2a0f9c9e36099f21.tar.bz2
forayios-a44529a1c62ba58ed09c029f2a0f9c9e36099f21.zip
Add back in description label and image to custom cell
I don't think this 100% is the correct way with SnapKit. Need to seek advice and improve the constraints. However, an improvement over before is that the accessibility font sizes actually do work as intended now! Now to add back in the segues somehow...
Diffstat (limited to 'foray/ForayTableViewController.swift')
-rw-r--r--foray/ForayTableViewController.swift26
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
}