简体   繁体   English

在仍支持ios 5.1的情况下如何在情节提要中使用UICollectionViewController?

[英]How to use UICollectionViewController in storyboard while still supporting ios 5.1?

It is a best practice to detect if a certain feature's class exists and degrade user's features depending on availability. 最佳实践是检测某个功能的类是否存在并根据可用性降级用户的功能。 I created UICollectionView in storyboard and a standard tableview to support ios 5.1 users. 我在情节提要中创建了UICollectionView,并创建了一个标准的Tableview以支持ios 5.1用户。 I then simply check if the user has this feature and segue to the appropriate scene. 然后,我只需检查用户是否具有此功能并选择合适的场景即可。 However, when I now try to compile my code I get a "dyld: Symbol not found: _UICollectionElementKindSectionHeader" This seems very anti-pattern of apple to not allow ios6.0 features in storyboard with a ios 5.1 deployment target. 但是,当我现在尝试编译我的代码时,我得到一个“ dyld:找不到符号:_UICollectionElementKindSectionHeader”。这似乎是苹果的反模式,它不允许带有iOS 5.1部署目标的情节提要中的ios6.0功能。

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

The above seems like a pretty reasonable approach to me... 以上对我来说似乎是一种非常合理的方法...

I know this is not proper to put only link answers but her it is not possible to include the whole files. 我知道仅放置链接答案是不合适的,但是她不可能包含整个文件。

Please see this . 请看这个

A controller is designed to provide the same functionality as UICollectionController of iOS 6 but still supports to iOS 4/5 控制器旨在提供与iOS 6的UICollectionController相同的功能,但仍支持iOS 4/5

What developer is telling 开发人员在说什么

PSTCollectionView PSTCollectionView
Open Source, 100% API compatible replacement of UICollectionView for iOS4.3+ 开源,iOS4.3 +的UICollectionView的100%API兼容替代

You want to use UICollectionView, but still need to support iOS4/5? 您想使用UICollectionView,但仍需要支持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. 我最初是为PSPDFKit编写的,它是我的iOS PDF框架,支持文本选择和注释,但是对于其他人来说,这个项目似乎很有用,可以让我自己保留它:)另外,我也希望阻止新的gridview的涌入。 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. 目标是使用iOS 4/5上的PSTCollectionView作为后备,并切换到iOS6上的UICollectionView。 We even use certain runtime tricks to create UICollectionView at runtime for older versions of iOS. 我们甚至使用某些运行时技巧在运行时为旧版本的iOS创建UICollectionView。 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. 实际上,这并不容易,尤其是在使用UICollectionView类的子类时,因为它们无法在运行时替换。

You can't. 你不能 As soon as you drop the collections view controller to the storyboard, it will try to reference it automatically, what will result in the compilation error you've got. 一旦将collections视图控制器放到情节提要中,它将尝试自动引用它,这将导致您遇到编译错误。

There's no compatibility solution for pre-6.0 deployment via storyboards, but PSTCollectionView does support iOS 5.0+ and is actively maintained. 没有通过情节提要进行6.0之前版本部署的兼容性解决方案,但PSTCollectionView确实支持iOS 5.0+并得到了积极维护。 It does work at runtime to use UICollectionView* on 6.0 and later, and should be storyboard compatible. 它在运行时确实可以在6.0及更高版本上使用UICollectionView* ,并且应该与情节UICollectionView*兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 继承UIRefreshControl,但仍支持iOS 5.1? - Subclassing UIRefreshControl but still supporting iOS 5.1? 如何复制包含故事板的iOS 5.1应用程序 - How to copy an iOS 5.1 app including the storyboard 如何在应用程序中包含 iOS 12+ api 调用,同时仍支持 iOS&lt;12 用户? - How to include iOS 12+ api call in app while still supporting iOS<12 users? 如何在uicollectionviewcontroller上使用触摸事件 - how to use touch events on uicollectionviewcontroller 如何在UICollectionViewController上方使用UIToolbar? - how to use UIToolbar above UICollectionViewController? 尝试本地化LaunchScreen.storyboard以在iOS 10中使用xcode 8.3.3支持语言时出现问题 - Issue while trying to Localise LaunchScreen.storyboard for supporting languages using xcode 8.3.3 in iOS 10 如何在仍然针对 iOS 15 的同时使用`.backgroundTask` 修饰符? - How to use `.backgroundTask` modifier while still targeting iOS 15? 在iOS 13中场景的UI状态恢复,同时仍支持iOS 12。 - UI state restoration for a scene in iOS 13 while still supporting iOS 12. No storyboards UICollectionViewController + diffableDataSource - 当您的手指仍在单元格上时,单元格未突出显示 - UICollectionViewController + diffableDataSource - cell gets unhighlighted while your finger is still on it 内存未在iOS 5.1中使用ARC和故事板发布 - memory not releasing with ARC and storyboard in iOS 5.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM