Sha256: 9c476f4672ac400a56399592d95a3bc1ea900ff8d0132d124eda1d45f2c0380a
Contents?: true
Size: 1014 Bytes
Versions: 10
Compression:
Stored size: 1014 Bytes
Contents
# This class have some modifications for UITextField: # * support padding, padding_left, padding_right options # * support placeholder_color, placeholder_font options class DMTextField < UITextField include MotionPrime::KeyValueStore attr_accessor :paddingLeft, :paddingTop, :padding, :placeholderColor, :placeholderFont # placeholder position def textRectForBounds(bounds) padding_left = self.paddingLeft || self.padding || 5 padding_top = self.paddingTop || self.padding || 3 CGRectInset(bounds, padding_left, padding_top) end # text position def editingRectForBounds(bounds) padding_left = self.paddingLeft || self.padding || 5 padding_top = self.paddingTop || self.padding || 3 CGRectInset(bounds, padding_left, padding_top) end def drawPlaceholderInRect(rect) color = self.placeholderColor || :gray.uicolor color.setFill font = self.placeholderFont || self.font || :system.uifont(16) self.placeholder.drawInRect(rect, withFont: font) end end
Version data entries
10 entries across 10 versions & 1 rubygems