Sha256: 87b1fcd8447f5782f024d39fe27aeff2ce20fa2a9b167af353b59ac32ea99ba1
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
module MotionPrime module SupportControlContentAlignment VERTICAL_ALIGNMENT_CONSTS = { UIControlContentVerticalAlignmentCenter => :center, UIControlContentVerticalAlignmentTop => :top, UIControlContentVerticalAlignmentBottom => :bottom, UIControlContentVerticalAlignmentFill => :fill # TODO: handle this value } def setContentVerticalAlignment(value) return unless @_content_vertical_alignment = VERTICAL_ALIGNMENT_CONSTS[value] super end def padding_top padding_top = self.paddingTop || self.padding if @_content_vertical_alignment == :bottom padding_bottom = self.paddingBottom || self.padding bounds_height - padding_bottom.to_i - line_height elsif @_content_vertical_alignment == :top padding_top.to_i else # center label padding_top_offset = padding_top.to_i - (self.paddingBottom || self.padding).to_i (bounds_height - line_height)/2 + 1 + padding_top_offset end end def padding_bottom (bounds_height - (line_height + padding_top)) end def line_height @_line_height || self.font.pointSize end def bounds_height self.bounds.size.height end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motion-prime-0.9.9.1 | motion-prime/support/_control_content_alignment.rb |