从自定义的 window 启动 cocoa app

2016-01-28 12:08:12 +08:00
 laobaozi

标题可能描述不准确
类似于 ios 创建 app 时默认创建 Main.storyboard,然后从这里启动.修改 info.plist,再在 AppDelegate 中设置 rootViewController 就可以从自定义的界面启动了,现在要在 cocoa 中实现类似的效果要怎么做,或者该查怎么查资料
//删除了 info.plist 中的启动项,然后程序貌似就不会进 AppDelegate 了....

2128 次点击
所在节点    iDev
2 条回复
HeartJ
2016-02-01 22:34:00 +08:00
自定义的界面是在 storyboard 中吗?选中要启动的界面,设置成 initial 就可以吧?我是小白,不知道是不是你说的意思。
vincentxbb
2016-02-03 16:54:39 +08:00
var mainWindowController:MainWindowController?

func applicationDidFinishLaunching(aNotification: NSNotification) {
// Insert code here to initialize your application

let mainWindowController = MainWindowController()
mainWindowController.showWindow(self)
self.mainWindowController = mainWindowController


}


MainWindowController 重写他的 windowNibName,返回对应的 xib 文件名字就可以啦,假如是 sb 的话,参照楼上的应该也没问题,不用删除 info.plist 的启动项的

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/253962

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX