Class: UITextField

Inherits:
Object show all
Defined in:
lib/ios/sugarcube-to_s/uitextfield.rb

Instance Method Summary collapse

Instance Method Details

#sugarcube_to_s(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/ios/sugarcube-to_s/uitextfield.rb', line 3

def sugarcube_to_s(options={})
  text = self.text
  if text && text.length > 20
    text = text[0..20] + '...'
  end
  placeholder = self.placeholder
  if placeholder && placeholder.length > 20
    placeholder = placeholder[0..20] + '...'
  end
  super options.merge(inner: {text: text, placeholder: placeholder, firstResponder?: firstResponder?})
end