使用多个窗口的 iOS 完整版/精简版
我的 Xcode 4.3 项目中有两个目标。每个目标都有自己的 X-info.plist 文件。我想要两个窗口 (MainWindow.xib),一个用于完整应用程序,一个用于 Lite 版本。我为每个目标设置了主界面,并在 X-info.plist 中设置了主 nib 文件基本名称,但它不起作用。我错过了什么? 谢谢
I have two targets in my Xcode 4.3 project. Each target has its own X-info.plist file. I would like to have two windows (MainWindow.xib), one for the full app and one for the Lite version. I set the Main Interface
for each target and also Main nib file base name
in the X-info.plist but it's not working. What did I miss?
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将预处理器宏添加到精简版
LITE=1
的目标。然后在代码中,当您想要以不同的方式执行某些操作时,可以使用#ifdef,例如:如果您想避免这样做并希望对两个笔尖使用相同的名称,则必须将其中一个添加为完整目标的成员,将另一个添加为精简目标的成员。
You can add a Preprocessor Macro to the target of the lite version
LITE=1
. Then in your code, when you want to execute something differently you can use#ifdef
, for example:If you want to avoid doing that and want to use the same name for the two nibs, you have to add one of them as a member of the full target and the other one as a member of the lite target.
您可以轻松地为不同目标使用相同的 .xib 文件名称。只需确保两个同名文件不是同一目标的成员即可。它们必须放置在 HD 上的不同目录中以及项目中的不同组中。
IB(图像资源等)和多个目标还存在一个已知错误:请参阅 两个具有单独 .xib 的目标(具有相同名称的图像资源)
但此信息适用于 XCode 4.2.x,不确定是否它对 XCode 4.3 有效
You can easily have the even same names for .xib files for different targets. Just make sure that two files with the same name aren't members of the same target. They have to be placed in different directories on HD and in different groups in project.
There is also a known bug with IB (image resources and so on) and multiple targets: see more at Two targets with separate .xib (image resources with same names)
But this information is for XCode 4.2.x, not sure if it/s valid for XCode 4.3