Skip to content
This repository was archived by the owner on Apr 2, 2018. It is now read-only.

Commit 838c71c

Browse files
committed
resize scrollView after keyboard hides
1 parent 1236d0f commit 838c71c

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/ios/IonicKeyboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@interface IonicKeyboard : CDVPlugin {
44
@protected
5-
id _resizeViewShowObserver;
5+
id _resizeViewShowObserver, _resizeViewHideObserver;
66
}
77

88
@property (readwrite, assign, getter = resizeView, setter = setResizeView:) CGFloat resizeView;

src/ios/IonicKeyboard.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ - (void)setResizeView:(CGFloat)resizeOffset
5959
usingBlock:^(NSNotification* notification) {
6060
[weakSelf performSelector:@selector(resizeViewWillShow:) withObject:notification afterDelay:0];
6161
}];
62+
63+
[nc removeObserver:_resizeViewHideObserver];
64+
_resizeViewHideObserver = [nc addObserverForName:UIKeyboardWillHideNotification
65+
object:nil
66+
queue:[NSOperationQueue mainQueue]
67+
usingBlock:^(NSNotification* notification) {
68+
[weakSelf performSelector:@selector(resizeViewWillHide:) withObject:notification];
69+
}];
6270
}
6371

6472
_resizeView = resizeOffset;
@@ -82,6 +90,11 @@ - (void)resizeViewWillShow:(NSNotification*)notif
8290

8391
}
8492

93+
- (void)resizeViewWillHide:(NSNotification*)notif
94+
{
95+
self.webView.scrollView.contentInset = UIEdgeInsetsZero;
96+
}
97+
8598
/* ------------------------------------------------------------- */
8699

87100
- (void)dealloc
@@ -133,3 +146,4 @@ - (void) disableScroll:(CDVInvokedUrlCommand*)command
133146

134147

135148
@end
149+

0 commit comments

Comments
 (0)