MacRuby xcode label not working

class HelloApp
        attr_accessor :label, :text_field, :button
        def clickedButton(sender)
            # implementation
            your_name = self.text_field.stringValue
            self.label.stringValue = "Hello,  #{your_name}"
        end
end

上面的代码在HelloApp.rb中问题是当我在文本框中输入内容时,点击按钮,标签只是说“你好”,而不是“Hello,namegoeshere”顺便说一句,我使用的是MacRuby。


Your code works for me in MacRuby .5

Does this log the user input to the console?

your_name = self.text_field.stringValue
puts "Your name is #{your_name}" 

If not, you may not have the text_field hooked up to the NSTextField in Interface Builder.

链接地址: http://www.djcxy.com/p/60482.html

上一篇: 升级到Xcode 4.2和iOS5后,应用程序不能在iPhone上运行

下一篇: MacRuby xcode标签不起作用