Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[r161440] <bug:///77924> (View not scrolling up far enough to see row…

… you're editing)

When in landscape mode, it seems that the order of notifications differs on iOS 5.0.1 such that our _keyboardVisible isn't set early enough.

So, we now listen for UIKeyboardWillShowNotification and set it there. Also, to get the animation started right, we adjust our size in the will-show hook, lest the animation sizing the content be start after the keyboard and the bottom toolbar be hidden temporarily due to lagging behind.
  • Loading branch information...
commit 87fb00cbcc86ecfdc2980f0df1a5caf0a21fef47 1 parent 04cdf92
Timothy J. Wood tjw authored
Showing with 27 additions and 1 deletion.
  1. +27 −1 Frameworks/OmniUI/iPad/OUIMainViewController.m
28 Frameworks/OmniUI/iPad/OUIMainViewController.m
View
@@ -415,7 +415,9 @@ - (void)setResizesToAvoidKeyboard:(BOOL)resizesToAvoidKeyboard;
// These notifications typically aren't too useful (at least on 5.1 and later) since device rotations can result in a did hide/show cycle when the keyboard really is staying on screen. But on 5.0.1, if you bring up the keyboard in landscape, hide it, background the app, and then foreground the app, the system throws a spurious UIKeyboardDidChangeFrameNotification that makes us leave a gap at the bottom. This can happen both with rotating to portrait and w/o rotating at all while the app is backgrounded. Ignore this when running on iOS 5.0.x
if (IsPreIOS51) {
+ [center addObserver:self selector:@selector(_keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[center addObserver:self selector:@selector(_keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
+ [center addObserver:self selector:@selector(_keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
[center addObserver:self selector:@selector(_keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];
}
} else {
@@ -423,7 +425,9 @@ - (void)setResizesToAvoidKeyboard:(BOOL)resizesToAvoidKeyboard;
[center removeObserver:self name:UIKeyboardDidChangeFrameNotification object:nil];
if (IsPreIOS51) {
+ [center removeObserver:self name:UIKeyboardWillShowNotification object:nil];
[center removeObserver:self name:UIKeyboardDidShowNotification object:nil];
+ [center removeObserver:self name:UIKeyboardWillHideNotification object:nil];
[center removeObserver:self name:UIKeyboardDidHideNotification object:nil];
}
}
@@ -604,16 +608,38 @@ - (void)_keyboardDidChangeFrame:(NSNotification *)note;
}
// See note where we subscribe to UIKeyboardDidShowNotification
+- (void)_keyboardWillShow:(NSNotification *)note;
+{
+ OBPRECONDITION(IsPreIOS51);
+
+ DEBUG_KEYBOARD("will show %@", note);
+ _keyboardVisible = YES;
+
+ if (IsPreIOS51)
+ // Without this, the view updates OK, but the animation of the inner view controller lags behind that of the keyboard.
+ [self _handleKeyboardFrameChange:note isDid:NO];
+}
+
- (void)_keyboardDidShow:(NSNotification *)note;
{
OBPRECONDITION(IsPreIOS51);
OBPRECONDITION(_keyboardVisible == NO);
- _keyboardVisible = YES;
+
+ DEBUG_KEYBOARD("did show %@", note);
+}
+
+- (void)_keyboardWillHide:(NSNotification *)note;
+{
+ OBPRECONDITION(IsPreIOS51);
+
+ DEBUG_KEYBOARD("will hide %@", note);
}
- (void)_keyboardDidHide:(NSNotification *)note;
{
OBPRECONDITION(IsPreIOS51);
OBPRECONDITION(_keyboardVisible == YES);
+
+ DEBUG_KEYBOARD("did hide %@", note);
_keyboardVisible = NO;
}
Please sign in to comment.
Something went wrong with that request. Please try again.