如何像在 iOS 中一样在 WP8 中使用 Prefix.pch? [英] How to use Prefix.pch in WP8 like in iOS?

查看:34
本文介绍了如何像在 iOS 中一样在 WP8 中使用 Prefix.pch?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS 中,我有 5 个使用相同代码的应用程序.我能够使用 Prefix.pch 文件中的值引用公共类并分离应用程序名称、主题和颜色.我的前缀文件有这些,

In iOS I have 5 application which use same code. I was able to refer the common classes and separate the application name, theme and color using the values from the Prefix.pch file. My Prefix file has these,

#define APPLICATION_NAME @"Application01"
#define APPLICATION_THEME @"Brown"

通过使用这些宏定义了我的前缀文件,在我的程序中我可以说

By using these macros defined my prefix file, in my program I can say

#if APPPLICATION_THEME = @"Brown"
-perform this-

我想在 WP8 中遵循相同的方法.我不知道在哪里定义这些宏值并在代码中使用它们.请帮助我实现这一目标.

I would like to follow the same approach in WP8. I don't know where do I define these macro values and to use them in the code. Please help me in achieving this.

推荐答案

只需替换

#define APPLICATION_NAME @"Application01" by #define APPLICATION_NAME_Application01

#if APPPLICATION_THEME = @"Brown" by #if APPPLICATION_THEME_Brown

除了#define之外,您可以在菜单Build->Conditional compiler Symbols:的项目属性中设置它,然后将APPLICATION_NAME_Application01

additional the instead of #define you can just set it in the project properties in the menu Build->Conditional compilation Symbols: and just put APPLICATION_NAME_Application01

这篇关于如何像在 iOS 中一样在 WP8 中使用 Prefix.pch?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆