I am trying to print out my cells detailed text label below the title of the cell. Here is all my code I have no errors when running, the detailed label just doesn't appear. I tried solutions from other forums including this one, nothing worked. I really am not sure why this is happening? maybe it's something in my cellForRowAt function
class LoginController: UIViewController, UITableViewDataSource, UITableViewDelegate {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return discussionTitles.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath)
cell.backgroundColor = UIColor.clear
cell.textLabel?.text = discussionTitles[indexPath.row]
cell.detailTextLabel?.text = discussionDescriptions[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "Discussion Board"
}
override func viewDidLoad() {
super.viewDidLoad()
self.hideKeyboardWhenTap()
view.backgroundColor = UIColor(red: 203/255, green: 215/255, blue: 242/255, alpha: 1.0)
discussionBoardView.register(UITableViewCell.self, forCellReuseIdentifier: "contactCell")
setupDiscussionBoard()
}
func setupDiscussionBoard() {
view.addSubview(discussionBoardView)
discussionBoardView.backgroundColor = UIColor(red: 203/255, green: 215/255, blue: 242/255, alpha: 1.0)
discussionBoardView.dataSource = self
discussionBoardView.delegate = self
discussionBoardView.translatesAutoresizingMaskIntoConstraints = false
discussionBoardView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
discussionBoardView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
discussionBoardView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
discussionBoardView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
}
}