iOS Developer
iOS Developer

Reputation: 321

one of the two labels not being appeared from a cell in tableview swift ios

I have two labels in my cell in tableview but when I run my app it shows only one label and prints this in console

[2142:52393] Warning: Attempt to present <UIAlertController: 0x7f89d80cc000> on <IAuditor.ViewController: 0x7f89d6d13600> whose view is not in the window hierarchy!

what I have made

enter image description here

what I get from data now

enter image description here

what I want

enter image description here

        let context = appDel.persistentContainer.viewContext
    let results = try! context.fetch(request)

    for result in results as! [NSManagedObject] {

        let formNameIs = result.value(forKey: "formName") as? String
        let formDescIs = result.value(forKey: "formDesc") as? String

    cell.titleLabel.text = formNameIs!
    cell.descLabel.text = formDescIs
        print(formNameIs!, formDescIs!)

}

Upvotes: 3

Views: 655

Answers (1)

Dharmesh Kheni
Dharmesh Kheni

Reputation: 71852

Just add heightForRowAt in your code as shown below:

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

    return 80 
}

Upvotes: 2

Related Questions