Sha256: 08179af841331ac3381cdd3b80ff8fc634d6f8a2763db69b464ba0e9b5fbf5eb
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
class UIView def <<(view) self.addSubview view end def to_s "{#{self.class.name} @ x: #{self.frame.origin.x} y:#{self.frame.origin.y}, "\ "#{self.frame.size.width}×#{self.frame.size.height}}"\ "#{self.superview ? ' child of ' + self.superview.class.name : ''}" end def fadeout(duration=0.3, options={}, &after) UIView.animateWithDuration(duration, delay: options[:delay] || 0, options: options[:options] || UIViewAnimationOptionCurveLinear, animations: proc{ self.layer.opacity = options[:opacity] || 0 }, completion:after ) end def move_to(position, duration=0.3, options={}, &after) UIView.animateWithDuration(duration, delay: options[:delay] || 0, options: options[:options] || UIViewAnimationOptionCurveLinear, animations: proc{ f = self.frame f.origin = position self.frame = position }, completion:after ) end def delta_to(delta, duration=0.3, options={}, &after) f = self.frame delta = Point(delta) position = Point(f.origin) position.x += delta.x position.y += delta.y UIView.animateWithDuration(duration, delay: options[:delay] || 0, options: options[:options] || UIViewAnimationOptionCurveLinear, animations: proc{ f = self.frame f.origin = position self.frame = position }, completion:after ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sugarcube-0.2.0 | lib/sugarcube/uiview.rb |