I am writing a simple MacRuby app. I have an NSView that draws an image inside of itself when its drawRect() is called.
Inside that NSView subclass my drawRect() has (among some other lines of code)
image = NSImage.imageNamed("mini_browser")
image.drawInRect( self.bounds, fromRect: self.frame, operation:NSCompositeSourceOver, fraction:1.0)
If I move my subclassed NSView via my_view.setFrameOrigin([x,y]) where x and y are some values, I get something like below. Any insight as to why this is happening? It seems almost as if the NSImage is not moving with the NSView that encloses it.
See and example here..
You’re doing it wrong. From the documentation, the second parameter specifies:
So you probably want to pass in NSZeroRect as the second parameter.