Module: UnderOs::UI::Style::Fonts
- Included in:
- UnderOs::UI::Style
- Defined in:
- lib/under_os/ui/style/fonts.rb
Constant Summary collapse
- BUTTONS_ALIGMENTS_MAP =
{ 'right' => UIControlContentHorizontalAlignmentRight, 'center' => UIControlContentHorizontalAlignmentCenter, 'justify' => UIControlContentHorizontalAlignmentFill, 'left' => UIControlContentHorizontalAlignmentLeft }
- TEXTNODES_ALIGMENTS_MAP =
{ 'right' => NSTextAlignmentRight, 'center' => NSTextAlignmentCenter, 'justify' => NSTextAlignmentJustified, 'left' => NSTextAlignmentLeft }
Instance Method Summary collapse
- #fontFamily ⇒ Object
- #fontFamily=(value) ⇒ Object
- #fontSize ⇒ Object
- #fontSize=(value) ⇒ Object
- #textAlign ⇒ Object
- #textAlign=(value) ⇒ Object
Instance Method Details
#fontFamily ⇒ Object
8 9 |
# File 'lib/under_os/ui/style/fonts.rb', line 8 def fontFamily end |
#fontFamily=(value) ⇒ Object
11 12 13 |
# File 'lib/under_os/ui/style/fonts.rb', line 11 def fontFamily=(value) @view.font = @view.font.fontWithName(value) end |
#fontSize ⇒ Object
15 16 |
# File 'lib/under_os/ui/style/fonts.rb', line 15 def fontSize end |
#fontSize=(value) ⇒ Object
18 19 20 21 |
# File 'lib/under_os/ui/style/fonts.rb', line 18 def fontSize=(value) @view.font = @view.font.fontWithSize(value) @view.sizeToFit if @type == :icon end |
#textAlign ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/under_os/ui/style/fonts.rb', line 23 def textAlign if @view.is_a?(UIButton) BUTTONS_ALIGMENTS_MAP.key(@view.contentHorizontalAlignment) elsif @view.respond_to?(:textAlignment) TEXTNODES_ALIGMENTS_MAP.key(@view.textAlignment) end end |
#textAlign=(value) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/under_os/ui/style/fonts.rb', line 31 def textAlign=(value) if @view.is_a?(UIButton) @view.contentHorizontalAlignment = BUTTONS_ALIGMENTS_MAP[value.to_s] || BUTTONS_ALIGMENTS_MAP['left'] elsif @view.respond_to?(:textAlignment) @view.textAlignment = TEXTNODES_ALIGMENTS_MAP[value.to_s] || BUTTONS_ALIGMENTS_MAP['left'] end end |