I am following the motioncasts screencast at: http://motioncasts.tv/start-building-views-in-rubymotion/
And there is some code:
button = UIButton.buttonWithType(UIButtonTypeRoundedRect)
button.frame = [[15, 300], [280,50]]
button.setTitle("Move to next view", forState: UIControlStateNormal)
button.addTarget(self,
action: "moveToChildView:",
formControlEvents: UIControlEventTouchUpInside)
Which is supposed to work, but when trying to compile produces the error:
(main)> 2013-04-18 18:41:06.205 12wbt[76267:c07] home_controller.rb:19:in `viewDidLoad': undefined method `addTarget' for #<UIRoundedRectButton:0x761fd40> (NoMethodError)
from app_delegate.rb:6:in `application:didFinishLaunchingWithOptions:'
2013-04-18 18:41:06.208 12wbt[76267:c07] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'home_controller.rb:19:in `viewDidLoad': undefined method `addTarget' for #<UIRoundedRectButton:0x761fd40> (NoMethodError)
from app_delegate.rb:6:in `application:didFinishLaunchingWithOptions:'
'
As far as I can tell, this is the exact code from the screencast which is supposed to work without error. What is wrong?