ios - 无法在 Today Extension ios 中加载 TableView

标签 ios swift tableview

我无法在今天的扩展中加载表格 View 。我删除了初始 View Controller 并将其替换为 tableView Controller 。是否在 TableView NCWidgetProviding 及其函数 widgetPerformUpdate 中添加了委托(delegate)。这只是一个示例应用程序,用于检查今天的扩展。任何人都可以回复并提供解决方案吗!!!

谢谢 Screenshot

最佳答案

我注意到的几件事:

  1. 尝试在viewDidLoad()中设置tableView的委托(delegate)和数据源:

    self.tableView.delegate = self
    self.tableView.dataSource = self
    
  2. 最好将 tableView.dequeueReusableCellWithIdentifierindexPath 一起使用:

    let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath)
    

更多相关信息here

如果以上都没有帮助,也许自动布局有问题?表格可能会显示,但只是不可见。

关于ios - 无法在 Today Extension ios 中加载 TableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40522523/

相关文章:

ios - 手动设置 UIButton 状态

swift - 没有初始值的存储属性 "text"会阻止合成初始化程序

ios - 如何自定义单元格的一部分

ios - 如何在 iOS 的 didselectrowatindexpath 中触发按钮操作方法, objective-c

ios - TableViewRow 中的标签被截断(Titanium Studio)

ios - TableViewCell 中的 Swift 3.0 文本字段未显示

ios - 过滤 tableView 行不会重新加载 tableView

ios - 如何确定文件是否为 zip 文件?

ios - 希望使用SceneKit改变3D空间音频的速度

SwiftUI:无法为图像设置动画