- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在将 iOS 应用程序移植到 OS X。我正在考虑使用 Apple 示例代码“AnimatedTableView”作为起点,但惊讶地发现它没有 NSApplicationDelegate。在 iOS 上,我通常在 applicationDidFinishLaunching 中以编程方式创建对象,并试图弄清楚如何在 OS X 上执行此操作,除非我不应该这么做。
AnimatedTableView 的 MainMenu.xib 包含一个引用其 Controller 类之一的“ContentController”对象。看起来此类的“wakeFromNib”方法是操作开始的地方。添加到 MainMenu.xib 的任何对象在应用程序启动时自动实例化是否正确?那么,我可以在 MainMenu.xib 中放置一个主 Controller 类,然后从那里开始以编程方式创建其他对象吗?或者,为了坚持我的 iOS 模式,我可以用 NSApplicationDelegate 对象替换 MainMenu.xib 中的 Controller 对象,并让它以编程方式创建主 Controller 对象?
这样对吗?我尽量避免 IB,显然缺少一些基本的理解。
最佳答案
Is it correct that any objects you add to MainMenu.xib are automatically instantiated on application launch?
更正确的说法是,设置为使用 .xib 文件而不是 Storyboard的 Cocoa 应用程序将自动加载在应用程序的 Info.plist 文件中指定为主 nib 文件的 .xib 文件。但是是的,基于 .xib 的应用程序通常会设置为在启动时加载 MainMenu.xib。
So, I could just put a master controller class in the MainMenu.xib and begin creating other objects programatically from there?
当然,这是一种有效的方法。
Or, to stick with my iOS pattern, I could replace the controller object in the MainMenu.xib with an NSApplicationDelegate object and have it programmatically create the master controller object?
项目中应该已经有一个应用程序委托(delegate)对象。更重要的是,主 .xib 文件中有一个 app delegate 代理,因此您可以将 outlet 添加到 app delegate 并将它们连接到主 .xib 文件中的对象。如果您想在应用程序委托(delegate)中创建“主 Controller ”对象,您当然可以这样做。
关于ios - UIApplicationDelegate 与 NSApplicationDelegate,MainMenu.xib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30403770/
当我从 Xcode 在 Debug模式下运行应用程序时,它可以工作,但是当我在 Release模式下运行它时,它会在输出以下内容后崩溃: Unable to load nib file: MainMe
每次我创建任何类型的 cocoa 项目(基于文档,带有核心数据和/或聚光灯导入器)并打开 MainMenu.xib 时,我都会在对象选项板窗口右下角看到一个警告标志,表示窗口已关闭屏幕边界。为什么会这
我正在 Xcode 5.1 中处理一个新项目,并且我一直在使用 Interface Builder 来创建和绑定(bind)大部分布局。我自定义了默认的 MainMenu.xib 以包含我想要的菜单项
我需要以编程方式在 Winform 中的窗体上显示主菜单的子菜单。NΕΤ 应用程序(类 MainMenu 和 MenuItem)。 例如显示包含菜单项文件的所有项目的子菜单。 例如如果菜单项文本为 &
一种常见的 UI 模式是在状态栏中显示与当前所选菜单项相关的文本。 过去,我在 winforms 中实现了这一点,方法是创建一个扩展程序提供程序,该扩展程序提供程序添加一个字符串属性,其中包含要在状态
我需要一种方法来更改 Cocoa 应用程序中菜单栏 (MainMenu.xib) 中的字符串,以便根据我设置的区域设置动态呈现。我已经为不同的语言环境创建了 MainMenu.strings 文件。目
如何判断所有 MainMenu Nib 控件(主要是主窗口)何时已加载?我想在启动时在主窗口顶部显示一个工作表,但是当我将调用 beginSheet 放入 awakeFromNib 内部时,我收到错误
我有一个包含窗口的 Nib (winA.xib)。我的应用程序委托(delegate)包含一个名为 WinAController 的 NSWindowController 子类。 WinAContro
我正在尝试使用箭头键或通过 Controller 上的方向键使我的菜单可导航。到目前为止,我运气不好。 问题是:有人可以指导我如何使我的当前菜单或任何 libgdx 菜单键盘可访问吗? 我对某些东西有
每当我构建以下程序时,Form1 的大小都会缩小 20。(在某些情况下,我需要对表单进行更改,例如将 someLaggyControl1 移动到几个像素,但并非总是如此。这很奇怪。)表单使用 Main
在 MainMenu.xib 中,我可以删除 NSObjects 来创建类实例。这些对象被删除的垂直顺序是它们将被分配的顺序吗?我可以信赖它吗? 最佳答案 不,您不能依赖对象列出的顺序作为它们实例化的
我已经开始开发一些小型 Cocoa 应用程序。它工作得很好,但现在我想创建我自己的 MainMenu(不使用 XCode 创建的默认 MainMenu.xib)。 但是我遇到了一些障碍。首先,我添加两
已经asked before ,但似乎没有明确的(当前)答案。是否真的有可能构建一个带有主菜单的 Cocoa 应用程序,仅通过代码(没有 MainMenu.xib 等),这样它仍然会提交到应用商店时能
我不知道如何让 macOS Cocoa 应用程序的包管理适用于 Xcode 8、Swift 3。无论我做什么,我都会得到: Unable to load nib file: MainMenu, exi
当您创建新的 Cocoa 应用程序时,Xcode 会为您生成 MainMenu.xib,其中包含一组预定义的菜单项(文件、编辑、格式、 View 等)。 我做了一个非常简单的应用程序。我真的不需要菜单
对于 iOS (Cocoa Touch),可以转到 main.m 并将 UIApplicationMain(int argc, char *argv[], nil, nil) 中的第四个参数替换为类您
我搜索了更改 Compact Framework 的 MainMenu 控件背景颜色的解决方案,我发现的唯一答案是您需要创建自定义控件。有没有人有这方面的示例代码? 最佳答案 我做了一些类似的事情,我
我在 WinForm 中使用 MainMenu 控件(不是 MenuStrip)。在设计 View 中,我可以在文本字段中放置一个 &,它会显示下划线,但是当程序运行并且我按下 ALT 时,它不会出现
我正在将 iOS 应用程序移植到 OS X。我正在考虑使用 Apple 示例代码“AnimatedTableView”作为起点,但惊讶地发现它没有 NSApplicationDelegate。在 iO
在我完成编写应用程序后第二次尝试打开文件 MainMenu.xib 时重新打开项目: 无法打开文档“MainMenu.xib”。操作无法完成。 * -[__NSArrayM insertObject:
我是一名优秀的程序员,十分优秀!