大佬教程收集整理的这篇文章主要介绍了iphone – 如何从Xcode中的相同共享代码创建多个应用程序?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Learn more about the concept of targets here。
通常情况下,大多数项目都有一个Target,它对应于一个产品/应用程序。如果您定义多个目标,您可以:
>包括一些源代码文件(或可能全部)在两个目标,一些在一个目标和一些在另一个目标
>您可以使用Build SetTings进行编辑,使用不同的设置编译两个目标。
例如,您可以为一个目标和其他宏定义预编译器宏(假设目标“PremiumVersion”中为OTHER_C_FLAGS = -DPREMIUM)和OTHER_C_FLAGS = -DLITE来定义“LiteVersion”目标中的LITE宏),然后包括类似的代码在你的来源:
-(IBACtion)commonCodeToBothTargetsHere { ... } -(void)dostuffOnlyAvailableForPremiumVersion { #if PREMIUM // This code will only be compiled if the PREMIUM macro is defined // namely only when you compile the "PremiumVersion" target .... // do real stuff #else // This code will only be compiled if the PREMIUM macro is NOT defined // namely when you compile the "LiteVersion" target [[[[UIAlertView alloc] initWithtitle:@"Only for premium" message:@"Sorry,this feature is reserved for premium users. Go buy the premium version on the AppStore!" delegate:self cancelButtontitle:@"Doh!" otherButtontitles:@"Go buy it!",nil] autorelease] show]; #endif } -(void)otherCommonCodeToBothTargetsHere { ... }@H_616_2@ @H_616_2@
以上是大佬教程为你收集整理的iphone – 如何从Xcode中的相同共享代码创建多个应用程序?全部内容,希望文章能够帮你解决iphone – 如何从Xcode中的相同共享代码创建多个应用程序?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。