ios - 使用 NSFetchedResultsController 的 UITableView 白板

标签 ios objective-c uitableview nsfetchedresultscontroller

NSFetchedResultsController 没有对象时为可见的 UITableView 创建空白平板 View 的最佳方法是什么?否则隐藏?

如果我向 UITableView 添加 subview ,我需要将其定位为与可能改变大小的 tableHeaderView 对齐。 而且我不确定如何在不破坏 NSFetchedResultsController 逻辑的情况下将 UITableViewCell 用作白板。

最佳答案

您可以使用几个选项:

  1. 如果基类是 UIViewController,请在 TableView 后面添加您的空消息 subview ,并将 hidden 设置为 YES table

  2. 如果您正在使用 UITableViewController,您可以将 tableHeaderView 设置为您的空消息 View ,确保其高度与表格的高度匹配,然后设置scrollEnabled 到表上的NO

  3. 无论哪种情况,您都可以向 UITableView 添加 subview 并使用 UIScrollViewDelegate 方法(主要是 scrollViewDidScroll:)来在滚动期间保持 View 静止。

关于ios - 使用 NSFetchedResultsController 的 UITableView 白板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9115237/

相关文章:

ios - 快速有效地重用类

ios - UIButton:快速单击Button时的单击声音

android - 在 Unity3D 中使用 Facebook API 从 iOS/Android 将图像分享到 Facebook

iphone - 在 App Purchase 中不适用于 iPhone 5 设备

objective-c - 如何使用 Quartz Core 绘制星星?

iOS webview ssl 连接(kCFStreamErrorDomainSSL,-9843)

iphone - 如何处理只读属性的内存

iphone - UITableView 滚动超出了我的 uiview 的范围

ios - UITableView 在 View 出现之前重置其背景颜色

ios - 搜索后 TableView 中 Cell 的值错误