ios - 如何在 Storyboard 中使用 UICollectionViewController 同时仍支持 ios 5.1?

标签 ios uicollectionview

最佳实践是检测某个功能的类别是否存在并根据可用性降低用户的功能。我在 storyboard 中创建了 UICollectionView 和一个标准的 tableview 来支持 ios 5.1 用户。然后,我只需检查用户是否具有此功能并转到适当的场景。但是,当我现在尝试编译我的代码时,我得到一个“dyld:找不到符号:_UICollectionElementKindSectionHeader”这似乎是苹果的反模式,不允许在带有 ios 5.1 部署目标的 Storyboard 中使用 ios6.0 功能。

if ([UICollectionView class]) {
    [self performSegueWithIdentifier:@"UserShow" sender:self];
} else {
    [self performSegueWithIdentifier:@"UserShowTable" sender:self];
}

以上对我来说似乎是一个非常合理的方法......

最佳答案

我知道只放链接答案是不合适的,但她不可能包含整个文件。

请看 this .

Controller 旨在提供与 iOS 6 的 UICollectionController 相同的功能,但仍支持 iOS 4/5

开发商在说什么

PSTCollectionView
Open Source, 100% API compatible replacement of UICollectionView for iOS4.3+

You want to use UICollectionView, but still need to support iOS4/5? Then you'll gonna love this project. I've originally written it for PSPDFKit, my iOS PDF framework that supports text selection and annotations, but this project seemed way to useful for others to to keep it for myself :) Plus, I would love the influx of new gridviews to stop. Better just write layout managers and build on a great codebase.

The goal is to use PSTCollectionView on iOS 4/5 as a fallback and switch to UICollectionView on iOS6. We even use certain runtime tricks to create UICollectionView at runtime for older versions of iOS. Ideally, you just link the files and everything works on older systems. Practically, it's not that easy, and especially when you're using subclasses of UICollectionView-classes, since they can't be replaced at runtime.

关于ios - 如何在 Storyboard 中使用 UICollectionViewController 同时仍支持 ios 5.1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13176494/

相关文章:

ios - UiCollcetionViewCell 特定的 segue 连接 TableView 显示 TableView 内的特定内容

ios - 在 uicollectionview 底部添加加载指示器

ios - 有什么方法可以从 Storyboard 中实例化原型(prototype) UITableViewCell 进行测试吗?

ios - NSLayoutConstraints 的 UIViewPropertyAnimator 使 View 消失

ios - 词法或预处理器问题 - 找不到 Cordova/CDVAppDelegate.h

ios - UITableView 的显示问题

ios - 在 UICollectionViewCell 中更新 UIProgressView

ios - 我想通过单击解析 Json 的 Collection View 单元格来获取特定数据

ios - 重新加载数据时 Collection View 为零

ios - 点击自定义注释并执行相应的功能