atnan (owner)

Revisions

gist: 206594 Download_button fork
public
Public Clone URL: git://gist.github.com/206594.git
Embed All Files: show embed
Objective-C #
1
2
3
4
5
6
7
8
9
10
11
12
13
- (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;
  }
}