2013-08-07 20 views
-2

我想制作一个通用应用程序,用于支持iOS 5和iPad的iPad,但支持iOS 6及更高版本我可以为每个设备上的不同操作系统版本创建通用应用程序吗?

是否可以使用相同的Xcode项目/应用程序构建来执行此操作?

我想在iPad版本中使用UICollectionViewUICollectionViewWaterfallLayout,需要iOS 6或更高版本。

+0

你为什么要这么做? –

+0

我想用UICollectionViewWaterfallLayout在ipad版本中使用uicollection ... uicollection支持ios 6或更高版本... –

+0

什么是毫无意义的愿望。 :) – holex

回答

2

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

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

例如

if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"6.0") && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
    { 
     //load controller with UICollectionView layout 
    } 
else 

{ 
//load simple layout controller 
} 

上面的宏从以下引用。抓住他们,因为他们对整个应用程序非常有用。将它们写入.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) 
1

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

1

简而言之,这是不可能的。

2

你可以在一个单一的应用程序通过将支票上的OS版本使用了一些宏象下面

#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 
} 
同时使用的东西

我希望这会是你。 谢谢。

相关问题