On Nov 7, 2011, at 11:33 AM, Robert Feldt wrote: > Hi, > > Noob to both MacRuby and Cocoa/Objective-C here (but not Ruby) so > please forgive is this is obvious but when I try to call > > timer = NSTimer.timerWithTimeInterval(60, self, > 'recheckAndUpdateTitle:', nil, true) > NSRunLoop.currentRunLoop.addTimer(timer) > > I get: > > undefined method `timerWithTimeInterval' for NSTimer:Class (NoMethodError) > > which is very confusing given: > > http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html#//apple_ref/occ/cl/NSTimer > > and > > http://stackoverflow.com/questions/1449035/how-do-i-use-nstimer > > What am I missing here? Any advice appreciated!?
Here is a paste from my program where I successfully set up and use a timer. Looks like I used a slightly different method from the same API. Hope it helps: class LevelView < NSView attr_accessor :keyboard_view def initWithFrame frame $game = Game.new(self) super(frame) @timer = NSTimer.scheduledTimerWithTimeInterval 1.0/FPS, target:self, selector:'doTick:', userInfo:nil, repeats:true NSRunLoop.currentRunLoop.addTimer @timer, forMode:NSModalPanelRunLoopMode NSRunLoop.currentRunLoop.addTimer @timer, forMode:NSEventTrackingRunLoopMode -- Elliot Temple http://beginningofinfinity.com/ _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel