Skip to content

Instantly share code, notes, and snippets.

@lsinger
Created January 19, 2009 00:30
Show Gist options
  • Save lsinger/48818 to your computer and use it in GitHub Desktop.
Save lsinger/48818 to your computer and use it in GitHub Desktop.
- (BOOL)resignFirstResponder
{
#if PLATFORM(DOM)
var element = [[self class] _inputElement];
//nil out dom handlers
element.onkeyup = nil;
element.onkeydown = nil;
element.onkeypress = nil;
_DOMElement.removeChild(element);
[self setStringValue:element.value]; // redundant?
// If textfield has no value, then display the placeholderValue
if (!_value)
[self setStringValue:[self placeholderString]];
#endif
//post CPControlTextDidEndEditingNotification
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment