Skip to content

Instantly share code, notes, and snippets.

@alanf
Created November 8, 2013 00:00
Show Gist options
  • Save alanf/7364019 to your computer and use it in GitHub Desktop.
Save alanf/7364019 to your computer and use it in GitHub Desktop.
- (void)reloadInterfaceFromTextField;
{
self.keyboardAttributes = [(id)self.textField performSelectorIfResponds:SDProtocolSelector(SQCustomKeyboardTextField, keyboardAttributes)] ?: [self defaultKeyboardAttributes];
NSString *returnKeyTitle = [self _returnKeyTitle];
[self.currentContentView.returnButton setTitle:returnKeyTitle forState:UIControlStateNormal];
if (returnKeyTitle.length) {
// Sometimes the title will be cleared for visual effect, in which case we won't want to delete the accessibility hint from the xib.
self.currentContentView.returnButton.accessibilityLabel = returnKeyTitle;
}
BOOL enabled = (self.textField.enablesReturnKeyAutomatically ? self.textField.text.length > 0 : YES);
self.currentContentView.returnButton.enabled = enabled;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment