TableView Cell Details Label Not Shwoing

Hi


Although I mage a TableView and dropped a cell and changed its style to Sub Title and loaded the info, but still

at run time the details text not showing ? project at link below.

--

Kindest Regards


h ttp s://www.dropbox.com/s/atmynl4nu6zekjx/tableView.zip?dl=0

Answered by Claude31 in 411471022

In cellForRowAt, need to dequeue a cell of the right format (subtitle), not create one which is not of subtitle type.


Change as follows, it works

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
      
     //        let cell = UITableViewCell ()
        let cell = tableView.dequeueReusableCell(withIdentifier: "normalCell", for: indexPath)



You could also call


        let cell = UITableViewCell (style: .subtitle, reuseIdentifier: nil)


But much better to dequeue.

Accepted Answer

In cellForRowAt, need to dequeue a cell of the right format (subtitle), not create one which is not of subtitle type.


Change as follows, it works

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
      
     //        let cell = UITableViewCell ()
        let cell = tableView.dequeueReusableCell(withIdentifier: "normalCell", for: indexPath)



You could also call


        let cell = UITableViewCell (style: .subtitle, reuseIdentifier: nil)


But much better to dequeue.

Thanks allot

TableView Cell Details Label Not Shwoing
 
 
Q