我一直在互联网和 Stackoverflow 中进行大量搜索。不幸的是,似乎没有太多关于新 Xcode 版本的信息,iOS 8 特别是使用 Swift 并且在没有 Interface Builder 的情况下工作。
作为起点选择的模板现在没有从空应用程序开始的选项。您拥有的最少设置是采用单 View 应用程序,它已经为您提供了 ViewController 和一个基本的 Storyboard。
我讨厌 Storyboard,也讨厌 Nib 。我想在代码中做所有事情。我试图删除 Storyboard文件,实例化窗口,设置 rootViewController 并使其可见,就像过去的美好时光一样。 ViewController 在没有 nib 和 bundle 的情况下初始化。
结果是一个带有这个错误的 SIGABRT:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle </Users/[username]/Library/Developer/CoreSimulator/Devices/BC38B690-D30E-44FB-93B1-AB861D03B414/data/Containers/Bundle/Application/B6C160C8-67E1-4A74-9F81-55D097262050/blabla.app> (loaded)'
我当然希望我仍然能够在没有 Interface Builder 的情况下制作 UI。任何人都知道如何进步?我记得我能够在之前的 Xcode 6 Beta 版本中使用空应用程序。
最佳答案
在我看来,storyBoards
很棒。它们使开发周期变得简单快捷。但如果您不想要它们,您可以创建一个 Single View Application
模板。
Delete the
storyBoard
and Follow these steps1) Go to Your Target
2) Deployment Info
3) Main Interface -> Delete Main and keep field empty
它不会加载 Storyboard或任何 View 。现在您有责任以编程方式加载 Window
并创建 rootViewControllers
和 views
关于view - iOS 8 - Swift - Xcode 6 Beta - 在没有界面生成器的情况下工作(没有 Nib 和 Storyboard),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25326806/