Sha256: 9383fcc6df513bd40fcb0f5d278e9b15cbe0ea54eb3757e49bb3239c40118276
Contents?: true
Size: 810 Bytes
Versions: 1
Compression:
Stored size: 810 Bytes
Contents
class HelloView < UIView def drawRect(rect) if @moved bgcolor = begin red, green, blue = rand(100), rand(100), rand(100) UIColor.colorWithRed(red/100.0, green:green/100.0, blue:blue/100.0, alpha:1.0) end text = "ZOMG!" else bgcolor = UIColor.blackColor text = @touches ? "Touched #{@touches} times!" : "Hello RubyMotion!" end bgcolor.set UIBezierPath.bezierPathWithRect(frame).fill font = UIFont.systemFontOfSize(24) UIColor.whiteColor.set text.drawAtPoint(CGPoint.new(10, 20), withFont:font) end def touchesMoved(touches, withEvent:event) @moved = true setNeedsDisplay end def touchesEnded(touches, withEvent:event) @moved = false @touches ||= 0 @touches += 1 setNeedsDisplay end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubymotionr-0.0.1 | spec/multiple-rubymotion-apps/Hello/app/hello_view.rb |