class UITextField_Delegate
Attributes
on_change_callback[RW]
Called from [textField addTarget:block
action:'call' forControlEvents:UIControlEventEditingChanged],
NOT a UITextFieldDelegate method.
Public Instance Methods
on_change(theTextField)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 147 def on_change(theTextField) if self.on_change_callback self.on_change_callback.call(theTextField) end end
textField(theTextField, shouldChangeCharactersInRange:range, replacementString:string)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 131 def textField(theTextField, shouldChangeCharactersInRange:range, replacementString:string) if self.shouldChangeCharactersInRange_callback return self.shouldChangeCharactersInRange_callback.call(theTextField, range, string) end # fix for UITextField in iOS7 http://stackoverflow.com/questions/19569688/uitextfield-spacebar-does-not-advance-cursor-in-ios-7/20129483#20129483 if BW::Device.ios_version >= "7.0" if range.location == theTextField.text.length && string == " " theTextField.text = theTextField.text.stringByAppendingString("\u00a0") return false end end true end
textFieldDidBeginEditing(theTextField)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 107 def textFieldDidBeginEditing(theTextField) if self.textFieldDidBeginEditing_callback return self.textFieldDidBeginEditing_callback.call(theTextField) end end
textFieldDidEndEditing(theTextField)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 125 def textFieldDidEndEditing(theTextField) if self.textFieldDidEndEditing_callback return self.textFieldDidEndEditing_callback.call(theTextField) end end
textFieldShouldBeginEditing(theTextField)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 100 def textFieldShouldBeginEditing(theTextField) if self.textFieldShouldBeginEditing_callback return self.textFieldShouldBeginEditing_callback.call(theTextField) end true end
textFieldShouldClear(theTextField)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 153 def textFieldShouldClear(theTextField) if self.textFieldShouldClear_callback return self.textFieldShouldClear_callback.call(theTextField) end true end
textFieldShouldEndEditing(theTextField)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 113 def textFieldShouldEndEditing(theTextField) if self.textFieldShouldEndEditing_callback return self.textFieldShouldEndEditing_callback.call(theTextField) end if BW::Device.ios_version >= "7.0" theTextField.text = theTextField.text.gsub("\u00a0", " ").strip end true end
textFieldShouldReturn(theTextField)
click to toggle source
# File lib/formotion/patch/ui_text_field.rb, line 160 def textFieldShouldReturn(theTextField) if self.textFieldShouldReturn_callback return self.textFieldShouldReturn_callback.call(theTextField) end true end