【发布时间】:2011-01-03 02:18:06
【问题描述】:
我正在尝试使用 XCode 和 Interface Builder 构建一个基本的 hello world 应用程序。但是,在 Interface Builder 中,我看不到要连接的插座。我转到对象检查器窗格的连接选项卡,它显示“新引用插座”。
我想知道我的代码是否错误。在这里
class HelloWorldController
attr_accessor :hello_label, :hello_button, :hello
def awakeFromNib
@hello = true
end
def changeLabel(sender)
if @hello
@hello_label.stringValue = "Good Bye"
@hello_button.title = "Hello"
@hello = false
else
@hello_label.stringValue = "Hello World"
@hello_button.title = "Good Bye"
@hello = true
end
end
end
据我了解,我应该能够看到 hello、hello_label、hello_button 和 changeLabel,但我没有。我想也许我在某个地方拼错了,但似乎也不是。这是两个界面构建器窗口的照片。
感谢任何帮助。我想我只是忽略了一些东西,但不确定。
更新:我通过重新安装 OS X 解决了这个问题。我怀疑有问题,因为安装了 X Code 4,不知道。但是,它现在可以与全新安装的 OS X、X Code 和 MacRuby 一起使用
【问题讨论】:
-
这对我来说是正确的。我假设您已经保存了源文件?另外,尝试“build clean”并重新启动 Interface Builder。
-
我已经保存了这个项目。事实上,我保存了项目并重新启动计算机,然后重新打开它。我只是打开它备份并做了一个清洁然后构建。然后在界面生成器中打开,同样的问题。我尝试删除和添加新的 NSObject 仍然是同样的问题。
标签: ruby xcode interface-builder macruby