Skip to content

Instantly share code, notes, and snippets.

@atnan
Created October 10, 2009 04:26
Show Gist options
  • Save atnan/206594 to your computer and use it in GitHub Desktop.
Save atnan/206594 to your computer and use it in GitHub Desktop.
- (void)keyboardWillShow:(NSNotification *)notification {
if(nil != self.view.window){
CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
CGRect keyboardBounds = [[[notification userInfo] valueForKey:UIKeyboardBoundsUserInfoKey] CGRectValue];
CGRect searchBounds = [self.searchBar bounds];
CGFloat height = CGRectGetHeight(appFrame) - CGRectGetHeight(keyboardBounds) - CGRectGetHeight(searchBounds);
CGRect visibleBounds = CGRectMake(CGRectGetMinX(appFrame),
CGRectGetMinY(appFrame) + CGRectGetHeight(searchBounds),
CGRectGetWidth(appFrame),
height);
self.overlay.frame = visibleBounds;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment