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

标签 ios swift uitableview

我在 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

我想要什么

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

}

最佳答案

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

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

    return 80 
}

关于ios - tableview swift ios 中的单元格中没有出现两个标签之一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47843995/

相关文章:

ios - 为什么 applicationWillResignActive 方法不起作用?

ios - Objective-C获取游戏数据的方法

ios - 在 iOS 中使用什么来在预定时间显示消息?

ios - 有没有什么办法可以让 VoiceOver 按命令朗读标签?

ios - 旧版本中的等效项是什么。当我在旧版本中运行时,该应用程序没有给我一个大的导航栏

iOS 蓝牙不发现设备

ios - 选择表格中的单元格无法正常工作

ios - uitableviewcontroller,带有 xib,从 appdelegate 加载,从不加载?

ios - 无法向服务 com.apple.WebKit.Networking 发送信号 : 113: Could not find specified service

ios - 遍历数组并更改每个 UITableView Cell 的背景颜色