简体   繁体   中英

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

在此输入图像描述

what I get from data now

在此输入图像描述

what I want

在此输入图像描述

        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!)

}

Just add heightForRowAt in your code as shown below:

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

    return 80 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM