Xcode没有故事板的单个项目

时间:2014-11-07 19:38:07

标签: ios xcode storyboard appdelegate

我试图阅读ios 7的大书呆子牧场书。 我知道它已经老了,但它有一个非常有趣的主题,我相信它是最好的书面和最好的学习书之一。

问题是我使用xcode 6.1并且模板完全不同。我还想将他们的Objective-c代码翻译成Swift。

翻译部分很简单但我在做一些可能很愚蠢的事情时遇到了一个重大问题。

这是我的代码

的AppDelegate

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

        var firstframe:CGRect = CGRectMake(160, 240, 100, 150)
        var firstView:HypnoView = HypnoView(frame:firstframe)

        firstView.backgroundColor = UIColor.redColor()
        self.window?.addSubview(firstView)


        return true
    }
}

HypnoView

import UIKit

class HypnoView: UIView {

    var frameView:CGRect = CGRectNull



    override init(frame: CGRect) {
        frameView = frame
        super.init(frame: frame)
    }

    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }


}

这是我得到的错误

2014-11-07 20:32:41.408 Hypno [7987:450667] ***由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:'无法在捆绑NSBundle(已加载)中找到名为'Main'的故事板“

该应用程序仍在寻找主要的故事板文件,但我无法找到它的链接...我怎么能解决这个问题,所以我可以从我自己的ViewController开始,而不是最终使用故事板?它应该是应用程序委托中加载所有内容的代码吗?感谢

2 个答案:

答案 0 :(得分:2)

删除"主故事板文件基本名称"来自info.plist的密钥

答案 1 :(得分:1)

单击项目的根文件夹,常规选项卡,主界面(此处列出了故事板)。

相关问题