Ios 我能否构建一个通用应用程序';针对每台设备上的不同操作系统版本?

Ios 我能否构建一个通用应用程序';针对每台设备上的不同操作系统版本?,ios,ios-universal-app,Ios,Ios Universal App,我想制作一个通用应用程序,用于支持iOS 5的iPhone和支持iOS 6及更高版本的iPad 是否可以使用相同的Xcode项目/应用程序构建来实现这一点 我想在需要iOS 6或更高版本的iPad版本中使用UICollectionView和uiCollectionViewWaterWallLayout。这是不可能的。您只能为一个应用程序定义一个基本SDK和一个部署目标。简单地说,不这是不可能的。这是不可能的,因为部署目标针对两个设备;iPhone和iPad。如果将其设置为5.0,两个都将至少支持

我想制作一个通用应用程序,用于支持iOS 5的iPhone和支持iOS 6及更高版本的iPad

是否可以使用相同的Xcode项目/应用程序构建来实现这一点


我想在需要iOS 6或更高版本的iPad版本中使用
UICollectionView
uiCollectionViewWaterWallLayout

这是不可能的。您只能为一个应用程序定义一个基本SDK和一个部署目标。

简单地说,这是不可能的。

这是不可能的,因为部署目标针对两个设备;iPhone和iPad。如果将其设置为5.0,两个都将至少支持iOS 5.0。您不能将其设置为“个人”

如果您想设置完全不同的布局,那么在加载控制器时,您可以检查设备的iOS版本和设备类型。为此,您必须使用不同的ViewController

e、 g

上面的宏是从下面引用的。抓取它们,因为它们对整个应用程序非常有用。将它们写入.pch文件

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)

#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

您可以在一个应用程序中同时使用这两种功能,方法是使用下面的宏检查操作系统的版本

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
所以你会像这样使用它

if(SYSTEM_VERSION_LESS_THAN(@"6.0")){
    //Do your stuffs that supports below 6.0
}else if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")){
    //Do your stuffs that supports => 6.0
}
我希望这能帮助你。
谢谢。

为什么要这样做???我想在ipad版本中将uicollection与UICollectionViewWaterWallLayout一起使用。。。uicollection支持ios 6或更高版本…这是一个毫无意义的愿望。:)
if(SYSTEM_VERSION_LESS_THAN(@"6.0")){
    //Do your stuffs that supports below 6.0
}else if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0")){
    //Do your stuffs that supports => 6.0
}