Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created June 18, 2009 20:12
Show Gist options
  • Select an option

  • Save probablycorey/132163 to your computer and use it in GitHub Desktop.

Select an option

Save probablycorey/132163 to your computer and use it in GitHub Desktop.
- (id)init {
self = [super initWithNibName:@"BankView" bundle:nil];
if (!self) return self;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:self.view.window];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:self.view.window];
return self;
}
- (void)keyboardWillShow:(NSNotification *)notification {
[self.view focusSubview:_textField withPadding:10 forNotification:notification];
}
- (void)keyboardWillHide:(NSNotification *)notification {
[self.view revertFocusForNotification:notification];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment