Sha256: 5edf32c128113c57f1fd61629681baa62e004e74942e4742b6579ce5285c25b3
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
# # This module handles all sorts of things related to fonts # and text attributes # module UnderOs::UI class Style module Fonts def fontFamily end def fontFamily=(value) @view.font = @view.font.fontWithName(value) end def fontSize end def fontSize=(value) @view.font = @view.font.fontWithSize(value) @view.sizeToFit if @type == :icon end def textAlign if @view.is_a?(UIButton) case @view.contentHorizontalAlignment when UIControlContentHorizontalAlignmentRight then 'right' when UIControlContentHorizontalAlignmentCenter then 'center' when UIControlContentHorizontalAlignmentFill then 'justify' else 'left' end elsif @view.respond_to?(:textAlignment) case @view.textAlignment when NSTextAlignmentRight then 'right' when NSTextAlignmentCenter then 'center' when NSTextAlignmentJustified then 'justify' else 'left' end end end def textAlign=(value) if @view.is_a?(UIButton) @view.contentHorizontalAlignment = case value.to_s when 'right' then UIControlContentHorizontalAlignmentRight when 'center' then UIControlContentHorizontalAlignmentCenter when 'justify' then UIControlContentHorizontalAlignmentFill else UIControlContentHorizontalAlignmentLeft end elsif @view.respond_to?(:textAlignment) @view.textAlignment = case value.to_s when 'right' then NSTextAlignmentRight when 'center' then NSTextAlignmentCenter when 'justify' then NSTextAlignmentJustified else NSTextAlignmentLeft end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
under-os-1.0.0 | lib/under_os/ui/style/fonts.rb |