在故事板中使用UICollectionViewControlle

在故事板中使用UICollectionViewControlle

本文介绍了如何在故事板中使用UICollectionViewController,同时仍支持ios 5.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最佳做法是检测某个功能的类是否存在,并根据可用性降低用户的功能。我在故事板中创建了UICollectionView,并在标准的tableview中创建了ios 5.1用户。然后我只是检查用户是否具有此功能并转到相应的场景。但是,当我现在尝试编译我的代码时,我得到一个dyld:未找到符号:_UICollectionElementKindSectionHeader这似乎非常反模式的苹果不允许ios6.0功能在故事板中具有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. 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.

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

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

The above seems like a pretty reasonable approach to me...

推荐答案

你做不到。只要将集合视图控制器拖放到故事板,它就会尝试自动引用它,这会导致编译错误。

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.

这篇关于如何在故事板中使用UICollectionViewController,同时仍支持ios 5.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 02:53