Class: ImageViewWithOverlay
- Inherits:
-
UIImageView
- Object
- UIImageView
- ImageViewWithOverlay
- Defined in:
- lib/motion-horizontal-scroll/image_view_with_overlay.rb
Constant Summary collapse
- OVERLAY_VIEW_TAG =
100
Instance Method Summary collapse
- #touchesBegan(touches, withEvent: event) ⇒ Object
- #touchesCancelled(touches, withEvent: event) ⇒ Object
- #touchesEnded(touches, withEvent: event) ⇒ Object
Instance Method Details
#touchesBegan(touches, withEvent: event) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/motion-horizontal-scroll/image_view_with_overlay.rb', line 4 def touchesBegan(touches,withEvent: event) = UIView.alloc.initWithFrame(self.bounds) .tag = OVERLAY_VIEW_TAG .alpha = 0.5 .backgroundColor = UIColor.blackColor self.addSubview() self.superview.touchesBegan(touches,withEvent: event) end |
#touchesCancelled(touches, withEvent: event) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/motion-horizontal-scroll/image_view_with_overlay.rb', line 25 def touchesCancelled(touches,withEvent: event) = self.viewWithTag(OVERLAY_VIEW_TAG) unless .nil? == true UIView.animateWithDuration(0.4, animations: lambda{ .alpha = 0 },completion: lambda{|done| .removeFromSuperview }) end self.superview.touchesCancelled(touches,withEvent: event) end |
#touchesEnded(touches, withEvent: event) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/motion-horizontal-scroll/image_view_with_overlay.rb', line 13 def touchesEnded(touches,withEvent: event) = self.viewWithTag(OVERLAY_VIEW_TAG) unless .nil? == true UIView.animateWithDuration(0.4, animations: lambda{ .alpha = 0 },completion: lambda{|done| .removeFromSuperview }) end self.superview.touchesEnded(touches,withEvent: event) end |