Skip to content

Commit

Permalink
Resize scrollview when keyboard dismisses, update demo gif. Fixes Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Collin Ruffenach committed Feb 16, 2014
1 parent 924e0a2 commit 9a6bcf2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions CRToastDemo/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ - (void)viewDidLoad {
name:UIKeyboardWillShowNotification
object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];

self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.contentView.frame),
CGRectGetMaxY(self.showNotificationButton.frame));

Expand Down Expand Up @@ -108,6 +113,16 @@ - (void)keyboardWillShow:(NSNotification*)notification {
CGRectGetMaxY(self.showNotificationButton.frame));
}

- (void)keyboardWillHide:(NSNotification*)notification {
self.scrollView.contentInset = UIEdgeInsetsMake([self.topLayoutGuide length],
0,
[self.bottomLayoutGuide length],
0);
self.scrollView.scrollIndicatorInsets = self.scrollView.contentInset;
self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.contentView.frame),
CGRectGetMaxY(self.showNotificationButton.frame));
}

#pragma mark - Overrides

CRToastAnimationType toastAnimationTypeFromSegmentedControl(UISegmentedControl *segmentedControl) {
Expand Down
Binary file modified screenshots/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9a6bcf2

Please sign in to comment.