iOS 今日扩展 : cellForRowAtIndexPath never called

标签 ios uitableview ios8 xcode6 today-extension

我正在尝试在我的 Today 扩展中使用 UITableView。我想,这是大多数人想要做的。当我运行扩展时,numberOfSectionsInTableView 被调用,numberOfRowsInSection 被调用,但 cellForRowAtIndexPath 从未被调用,因此 TableView 永远不会显示。有没有其他人在今天的扩展中成功使用表格 View ?

最佳答案

tableView 总是想知道它有多少行/节,但通常只会在即将显示一个单元格时询问单元格。

tableView 不会请求它无法显示的单元格,特别是当 tableView 没有高度时。

确保您的 ViewController 和 TableView 都具有非零区域框架!

If a widget has additional content to display, you can rely on Auto Layout constraints to adjust the widget’s height as appropriate. If you don’t use Auto Layout, you can use the UIViewController property preferredContentSize to specify the widget’s new height.

App Extension Programming Guide

关于iOS 今日扩展 : cellForRowAtIndexPath never called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25272725/

相关文章:

ios - 在 table 外敲击时关闭键盘

ios - 当选择另一个单元格按钮时取消选择 Collection View 单元格按钮

uitableview - ios 14 Uitableviewcell 与 textField 不工作

ios - reloadData() 不会更新单元格标签

objective-c - iPhone 6 Plus 上的 UISplitViewController 旋转大师 Master

ios - 动态/可取消排队的 UITableviewcells 中的 UITextfield

ios - iAd 在 SpriteKit 中使用 Swift

ios - 如何在 swift 中集成 PayU Money

ios - iPad Split View Controller : Reloading the root view controller's tableview from the detail view controller

ios - TableView 中的 UIBlurEffect 在转换时似乎在背景中抽动或移动