iphone - 如何在 collectionView 中重新加载补充 View

标签 iphone ios objective-c ipad

是否有一种简单的方法可以仅在 UICollectionViewFlowLayout 中重新加载辅助 View ?我不想重新加载整个东西。有可能吗?

最佳答案

查看文档后,我不确定是否要重新加载单个补充 View ,但您可以使用 reloadSections: 更新 UICollectionView 中的 1 个或多个部分。 ( documentation ) 因此,当节标题需要更新时,您可以调用:

objective-C :

[self.collectionView reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 3)]];

swift :

self.collectionView?.reloadSections(IndexSet(0 ..< 3))

恰好调用:

- (UICollectionReusableView *)collectionView: (UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {

       //Place logic for handling update here...
}

关于iphone - 如何在 collectionView 中重新加载补充 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14289669/

相关文章:

ios - 允许用户继续在 iOS 应用程序中收听他们的音乐

iphone - 在 xcode/ios 中以编程方式编辑 RTF/DOC 文件

objective-c - 未调用 NSNotificationCenter 选择器

Objective-C 前向声明与#imports

iphone - 应用发布到Appstore后图像消失

iphone - 锁定手机后,NSStream结束

ios - 在 objective-c 中使用 NSUserDefaults 保存、加载和更新获胜计数

ios - 单击按钮在 iPhone 上播放视频作为背景?

ios - 启用为假时不显示按钮文本

ios - 音频编解码器加密