That is my code. I checked IBOulets connection, Identifier, class names.
and discover some query and reply which on similar boat. however did not phrases.
what did I missed? Thanks for studying. 🙂
HomeViewController.swift
import UIKit
struct Label {
let high: String
let day: String
let abstract: String
}
class HomeViewController: UIViewController {
@IBOutlet weak var upperTableView: UITableView!
@IBOutlet weak var lowerTableView: UITableView!
let upperCellID = "UpperTableViewCell"
let lowerCellID = "LowerTableViewCell"
var dateString: String!
var labels: [Label] = [
Label(top: "title1", day: "2023.10.1.", summary: "Test"),
Label(top: "title2", day: "2023.10.2.", summary: "Test"),
Label(top: "title3", day: "2023.10.3.", summary: "Test")
]
override func viewDidLoad() {
tremendous.viewDidLoad()
// Do any extra setup after loading the view.
// Higher Desk (Your To-Do)
upperTableView.delegate = self
upperTableView.dataSource = self
upperTableView.register(UpperTableViewCell.self, forCellReuseIdentifier: upperCellID)
// Decrease Desk (Your To-Do)
lowerTableView.delegate = self
lowerTableView.dataSource = self
lowerTableView.register(LowerTableViewCell.self, forCellReuseIdentifier: lowerCellID)
}
/*
// MARK: - Navigation
// In a storyboard-based software, you'll usually need to do some preparation earlier than navigation
override func put together(for segue: UIStoryboardSegue, sender: Any?) {
// Get the brand new view controller utilizing segue.vacation spot.
// Cross the chosen object to the brand new view controller.
}
*/
}
extension HomeViewController: UITableViewDelegate, UITableViewDataSource {
// These are working!
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
swap tableView {
case upperTableView:
print("you tabbed me!(Higher)")
case lowerTableView:
print("Under!")
default:
print("exterior of desk.")
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection part: Int) -> Int {
return labels.depend
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
var returnCell: UITableViewCell?
if tableView == self.upperTableView {
let cell = tableView.dequeueReusableCell(withIdentifier: self.upperCellID, for: indexPath) as! UpperTableViewCell
cell.topLabel?.textual content = labels[indexPath.row].high
returnCell = cell
} else if tableView == lowerTableView {
let cell = tableView.dequeueReusableCell(withIdentifier: self.lowerCellID, for: indexPath) as! LowerTableViewCell
cell.titleLabel?.textual content = labels[indexPath.row].high
returnCell = cell
}
return returnCell!
}
}
UpperTableViewCell.swift
import UIKit
class UpperTableViewCell: UITableViewCell {
@IBOutlet weak var topLabel: UILabel!
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var summaryLabel: UILabel!
override func awakeFromNib() {
tremendous.awakeFromNib()
// Initialization code
}
override func setSelected(_ chosen: Bool, animated: Bool) {
tremendous.setSelected(chosen, animated: animated)
// Configure the view for the chosen state
}
}
LowerTableViewCell.swift
import UIKit
class LowerTableViewCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
override func awakeFromNib() {
tremendous.awakeFromNib()
// Initialization code
}
override func setSelected(_ chosen: Bool, animated: Bool) {
tremendous.setSelected(chosen, animated: animated)
// Configure the view for the chosen state
}
}
I attempted present labels in my higher and decrease TableView.
however there may be nothing confirmed up.