Class: UITextField
Overview
Methods which use blocks for UITextFieldDelegate methods. EX field.should_end? do |text_field|
if text_field.text != "secret"
return false
end
true
end
Also includes an on_change method, which calls after the text has changed (there is no UITextFieldDelegate equivalent.) EX field.on_change do |text_field|
p text_field.text
end
Instance Method Summary collapse
-
#on_begin(&block) ⇒ Object
block takes argument textField.
-
#on_change(&block) ⇒ Object
block takes argument textField.
-
#on_end(&block) ⇒ Object
block takes argument textField.
-
#should_begin?(&block) ⇒ Boolean
block takes argument textField; should return true/false.
-
#should_change?(&block) ⇒ Boolean
block takes argument textField, range [NSRange], and string; should return true/false.
-
#should_clear?(&block) ⇒ Boolean
block takes argument textField; should return true/false.
-
#should_end?(&block) ⇒ Boolean
block takes argument textField; should return true/false.
-
#should_return?(&block) ⇒ Boolean
block takes argument textField; should return true/false.
Instance Method Details
#on_begin(&block) ⇒ Object
block takes argument textField
26 27 28 29 30 |
# File 'lib/formotion/patch/ui_text_field.rb', line 26 def on_begin(&block) add_delegate_method do @delegate.textFieldDidBeginEditing_callback = block end end |
#on_change(&block) ⇒ Object
block takes argument textField
54 55 56 57 58 59 |
# File 'lib/formotion/patch/ui_text_field.rb', line 54 def on_change(&block) add_delegate_method do @delegate.on_change_callback = block self.addTarget(@delegate, action: 'on_change:', forControlEvents: UIControlEventEditingChanged) end end |
#on_end(&block) ⇒ Object
block takes argument textField
40 41 42 43 44 |
# File 'lib/formotion/patch/ui_text_field.rb', line 40 def on_end(&block) add_delegate_method do @delegate.textFieldDidEndEditing_callback = block end end |
#should_begin?(&block) ⇒ Boolean
block takes argument textField; should return true/false
19 20 21 22 23 |
# File 'lib/formotion/patch/ui_text_field.rb', line 19 def should_begin?(&block) add_delegate_method do @delegate.textFieldShouldBeginEditing_callback = block end end |
#should_change?(&block) ⇒ Boolean
block takes argument textField, range [NSRange], and string; should return true/false
47 48 49 50 51 |
# File 'lib/formotion/patch/ui_text_field.rb', line 47 def should_change?(&block) add_delegate_method do @delegate.shouldChangeCharactersInRange_callback = block end end |
#should_clear?(&block) ⇒ Boolean
block takes argument textField; should return true/false
62 63 64 65 66 |
# File 'lib/formotion/patch/ui_text_field.rb', line 62 def should_clear?(&block) add_delegate_method do @delegate.textFieldShouldClear_callback = block end end |
#should_end?(&block) ⇒ Boolean
block takes argument textField; should return true/false
33 34 35 36 37 |
# File 'lib/formotion/patch/ui_text_field.rb', line 33 def should_end?(&block) add_delegate_method do @delegate.textFieldShouldEndEditing_callback = block end end |
#should_return?(&block) ⇒ Boolean
block takes argument textField; should return true/false
69 70 71 72 73 |
# File 'lib/formotion/patch/ui_text_field.rb', line 69 def should_return?(&block) add_delegate_method do @delegate.textFieldShouldReturn_callback = block end end |