Sha256: a2f4aeff638524844ca19cb70ce0e4d309fd1ebed3f72ae2115e954fd6d39f25

Contents?: true

Size: 1.21 KB

Versions: 17

Compression:

Stored size: 1.21 KB

Contents

# @provides MotionKit::UIButtonHelpers
# @requires MotionKit::UIViewHelpers
module MotionKit
  class UIButtonHelpers < UIViewHelpers
    targets UIButton

    def title(value)
      title(value, state: UIControlStateNormal)
    end

    def title(value, state: state)
      if value.is_a?(NSAttributedString)
        target.setAttributedTitle(value, forState: state)
      else
        target.setTitle(value, forState: state)
      end
    end

    def title_color(value)
      title_color(value, state: UIControlStateNormal)
    end

    def title_color(value, state: state)
      target.setTitleColor(value, forState: state)
    end

    def title_shadow_color(value)
      title_shadow_color(value, state: UIControlStateNormal)
    end

    def title_shadow_color(value, state: state)
      target.setTitleShadowColor(value, forState: state)
    end

    def background_image(value)
      background_image(value, state: UIControlStateNormal)
    end

    def background_image(value, state: state)
      target.setBackgroundImage(value, forState: state)
    end

    def image(value)
      image(value, state: UIControlStateNormal)
    end

    def image(value, state: state)
      target.setImage(value, forState: state)
    end

  end
end

Version data entries

17 entries across 15 versions & 1 rubygems

Version Path
motion-kit-1.1.1 lib/motion-kit-tvos/helpers/uibutton_helpers.rb
motion-kit-1.1.0 lib/motion-kit-tvos/helpers/uibutton_helpers.rb
motion-kit-1.0.3 lib/motion-kit-tvos/helpers/uibutton_helpers.rb
motion-kit-1.0.2 lib/motion-kit-tvos/helpers/uibutton_helpers.rb
motion-kit-1.0.1 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-1.0.1 lib/motion-kit-tvos/helpers/uibutton_helpers.rb
motion-kit-1.0.0 lib/motion-kit-tvos/helpers/uibutton_helpers.rb
motion-kit-1.0.0 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.18.0 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.17.0 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.16.0 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.15.0 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.14.2 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.14.1 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.14.0 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.13.0 lib/motion-kit-ios/helpers/uibutton_helpers.rb
motion-kit-0.12.0 lib/motion-kit-ios/layouts/uibutton_helpers.rb