setText bug in ofxiPhoneKeyboard (+ fix :-) )

Hi folks,

Found a bug in setting the text in textfields, in OF0073.

If you just use the normal setText method it just displays it temporarily (as if you’re still editing) and doesn’t save it.
You can check this by trying a getText immediately after the setText and you’ll see the getText returns null. getLabelText returns the setText value, but as soon as you close the textfield, that value is gone.

So, if you want your setText to store the value immediately upon setting, you need to do this:

In ofxiPhoneKeyboard.mm:

Old code:

  
- (void) setText: (NSString *)text  
{  
	[_textField setText:text];  
  
}  

New code:

  
- (void) setText: (NSString *)text  
{  
	[_textField setText:text];  
    [self textFieldDidEndEditing:_textField];  
  
}  

Hope that helps someone!

It helped me, a LOT!
I was having a hard time to get a sign in process more robust.

Thanks for sharing.

I’ve submitted this as an issue if you would like to track it:
https://github.com/openframeworks/openFrameworks/issues/1780

thanks for sharing the solution!