这两个标签中的一个没有从tableview swift ios中的单元格中出现

问题描述 投票:3回答:1

我在tableview中的单元格中有两个标签,但是当我运行我的应用程序时,它只显示一个标签并在控制台中打印出来

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

我做了什么

我现在从数据中获得了什么

enter image description here

我想要的是

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

}
ios swift uitableview
1个回答
2
投票

只需在代码中添加heightForRowAt,如下所示:

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

    return 80 
}
© www.soinside.com 2019 - 2024. All rights reserved.