Sha256: 9a86d21c4fa4a838433b61aee5f465f5a5698f51dde64fd85ec2783d7169860f

Contents?: true

Size: 497 Bytes

Versions: 3

Compression:

Stored size: 497 Bytes

Contents

# @requires MotionKit::UIViewLayout
module MotionKit
  class UIViewLayout

    # gradient colors:
    def gradient(&block)
      gradient_layer = target.motion_kit_meta(:motionkit_gradient_layer) || begin
        gradient_layer = CAGradientLayer.layer
        gradient_layer.frame = CGRect.new([0, 0], target.frame.size)
        target.layer.insertSublayer(gradient_layer, atIndex:0)

        gradient_layer
      end
      context(gradient_layer, &block)

      gradient_layer
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
motion-kit-0.9.2 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.9.1 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.9.0 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb