Class: MPTextField
- Inherits:
-
UITextField
- Object
- UITextField
- MPTextField
- Includes:
- MotionPrime::SupportControlContentAlignment, MotionPrime::SupportKeyValueStore, MotionPrime::SupportPaddingAttribute
- Defined in:
- motion-prime/support/mp_text_field.rb
Constant Summary
Constants included from MotionPrime::SupportControlContentAlignment
MotionPrime::SupportControlContentAlignment::VERTICAL_ALIGNMENT_CONSTS
Instance Attribute Summary collapse
-
#placeholderAlignment ⇒ Object
Returns the value of attribute placeholderAlignment.
-
#placeholderColor ⇒ Object
Returns the value of attribute placeholderColor.
-
#placeholderFont ⇒ Object
Returns the value of attribute placeholderFont.
-
#readonly ⇒ Object
Returns the value of attribute readonly.
Class Method Summary collapse
Instance Method Summary collapse
- #drawPlaceholderInRect(rect) ⇒ Object
-
#editingRectForBounds(bounds) ⇒ Object
text position.
-
#textRectForBounds(bounds) ⇒ Object
placeholder position.
Methods included from MotionPrime::SupportControlContentAlignment
#bounds_height, #line_height, #padding_bottom, #padding_top, #setContentVerticalAlignment
Methods included from MotionPrime::SupportPaddingAttribute
#apply_padding, #apply_padding!, #apply_padding?, #padding_bottom, #padding_insets, #padding_left, #padding_right, #padding_top
Methods included from MotionPrime::SupportKeyValueStore
Instance Attribute Details
#placeholderAlignment ⇒ Object
Returns the value of attribute placeholderAlignment.
12 13 14 |
# File 'motion-prime/support/mp_text_field.rb', line 12 def placeholderAlignment @placeholderAlignment end |
#placeholderColor ⇒ Object
Returns the value of attribute placeholderColor.
12 13 14 |
# File 'motion-prime/support/mp_text_field.rb', line 12 def placeholderColor @placeholderColor end |
#placeholderFont ⇒ Object
Returns the value of attribute placeholderFont.
12 13 14 |
# File 'motion-prime/support/mp_text_field.rb', line 12 def placeholderFont @placeholderFont end |
#readonly ⇒ Object
Returns the value of attribute readonly.
12 13 14 |
# File 'motion-prime/support/mp_text_field.rb', line 12 def readonly @readonly end |
Class Method Details
.default_padding_left ⇒ Object
14 15 16 |
# File 'motion-prime/support/mp_text_field.rb', line 14 def self.default_padding_left 5 end |
.default_padding_right ⇒ Object
18 19 20 |
# File 'motion-prime/support/mp_text_field.rb', line 18 def self.default_padding_right 5 end |
Instance Method Details
#drawPlaceholderInRect(rect) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'motion-prime/support/mp_text_field.rb', line 38 def drawPlaceholderInRect(rect) color = self.placeholderColor || :gray.uicolor color.setFill truncation = :tail_truncation.uilinebreakmode alignment = (placeholderAlignment || :left.nstextalignment) self.placeholder.drawInRect(rect, withFont: placeholder_font, lineBreakMode: truncation, alignment: alignment) end |
#editingRectForBounds(bounds) ⇒ Object
text position
31 32 33 34 35 36 |
# File 'motion-prime/support/mp_text_field.rb', line 31 def editingRectForBounds(bounds) @_line_height = self.font.pointSize rect = calculate_rect_for(bounds) @_line_height = nil rect end |
#textRectForBounds(bounds) ⇒ Object
placeholder position
23 24 25 26 27 28 |
# File 'motion-prime/support/mp_text_field.rb', line 23 def textRectForBounds(bounds) @_line_height = placeholder_font.pointSize rect = calculate_rect_for(bounds) @_line_height = nil rect end |