Xcode 中的“主界面”实际上*做什么*?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14420768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:34:04  来源:igfitidea点击:

What does "Main Interface" in Xcode actually *do*?

iosxcodecocoa-touch

提问by Christophe

I'm moving some older projects to Xcode 4.5, and I'm a bit baffled as to the actual function of the Main Interface project dropdown. What does the framework actually do with that value?

我正在将一些较旧的项目移至 Xcode 4.5,我对 Main Interface 项目下拉列表的实际功能感到有些困惑。该框架实际上如何处理该值?

采纳答案by DrummerB

That's where you can specify what Interface Builder file (xib) you want to load on launch, if you're not using a Storyboard.

如果您不使用 Storyboard,您可以在此处指定要在启动时加载的 Interface Builder 文件 (xib)。

回答by brian.clear

beware if you have a storyboard based project. Editing the MAIN INTERFACE field manually is dangerous. If storyboard is not found it thinks you mean a NIB. will change the app to a NIB based project. Safer to choose a storyboard from the drop down.

如果您有基于故事板的项目,请当心。手动编辑 MAIN INTERFACE 字段是危险的。如果未找到故事板,则认为您的意思是 NIB。将应用程序更改为基于 NIB 的项目。从下拉菜单中选择故事板更安全。

BEFORE - i has a storyboard based project
UIMainStoryboardFile~ipad : Main_iPad
UIMainStoryboardFile      : Main_iPhone

I mistype the name in MAIN INTERFACE field to Main_iPhone1 I ran the app and it crashed as Main_iPhone1.storyboard doesnt exist I changed it back to Main_iPhone but project refused to build even after a lot of cleaning.

我将 MAIN INTERFACE 字段中的名称错误地输入到 Main_iPhone1 我运行了该应用程序,它崩溃了,因为 Main_iPhone1.storyboard 不存在我将它改回 Main_iPhone 但即使经过大量清理,项目也拒绝构建。

Casued by the key in the plist also changing along with the value

由 plist 中的键引起的也随着值而变化

AFTER
UIMainStoryboardFile : Main_iPad
NSMainNibFile          : Main_iPhone1  <<project changes to NIB based

Changing Main_iPhone1 back to Main_iPhone only changed it from Main_iPhone1.xib to Main_iPhone.xib which doesnt exist and also crashes.

将 Main_iPhone1 改回 Main_iPhone 只会将其从 Main_iPhone1.xib 更改为 Main_iPhone.xib,它不存在并且也会崩溃。