Class: MPButton

Inherits:
UIButton
  • Object
show all
Includes:
MotionPrime::SupportControlContentAlignment, MotionPrime::SupportKeyValueStore, MotionPrime::SupportPaddingAttribute
Defined in:
motion-prime/support/mp_button.rb

Constant Summary

Constants included from MotionPrime::SupportControlContentAlignment

MotionPrime::SupportControlContentAlignment::VERTICAL_ALIGNMENT_CONSTS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MotionPrime::SupportControlContentAlignment

#bounds_height, #line_height, #padding_bottom, #padding_top, #setContentVerticalAlignment

Methods included from MotionPrime::SupportPaddingAttribute

#apply_padding, #padding_bottom, #padding_insets, #padding_left, #padding_right, #padding_top

Methods included from MotionPrime::SupportKeyValueStore

#setValue

Instance Attribute Details

#sizeToFitObject

Returns the value of attribute sizeToFit.



9
10
11
# File 'motion-prime/support/mp_button.rb', line 9

def sizeToFit
  @sizeToFit
end

Class Method Details

.default_padding_leftObject



24
25
26
# File 'motion-prime/support/mp_button.rb', line 24

def self.default_padding_left
  5
end

.default_padding_rightObject



28
29
30
# File 'motion-prime/support/mp_button.rb', line 28

def self.default_padding_right
  5
end

Instance Method Details

#apply_padding!(rect) ⇒ Object



32
33
34
# File 'motion-prime/support/mp_button.rb', line 32

def apply_padding!(rect)
  self.setTitleEdgeInsets(padding_insets)
end

#apply_padding?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'motion-prime/support/mp_button.rb', line 36

def apply_padding?
  super && !@custom_title_inset_drawn
end

#drawRect(rect) ⇒ Object



40
41
42
43
# File 'motion-prime/support/mp_button.rb', line 40

def drawRect(rect)
  apply_padding(rect)
  super
end

#setImage(value) ⇒ Object



15
16
17
# File 'motion-prime/support/mp_button.rb', line 15

def setImage(value)
  setImage value, forState: UIControlStateNormal
end

#setTitle(value) ⇒ Object



11
12
13
# File 'motion-prime/support/mp_button.rb', line 11

def setTitle(value)
  setTitle value, forState: UIControlStateNormal
end

#setTitleEdgeInsets(value) ⇒ Object



19
20
21
22
# File 'motion-prime/support/mp_button.rb', line 19

def setTitleEdgeInsets(value)
  @custom_title_inset_drawn = true
  super
end