TPKeyboardAvoiding
TPKeyboardAvoiding copied to clipboard
On 3.5" iOS device, with a view having Navi controller and 4 textFields, the content size is large then scroll view's frame when keyboard hides.
The view has 4 text fields and not higher then the root UIView's size.
I added a line to fix the issue:
-
(void)keyboardWillHide:(NSNotification*)notification { _keyboardRect = CGRectZero; _keyboardVisible = NO;
// Restore dimensions to prior size [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]]; [UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]]; self.contentInset = _priorInset; self.contentOffset = _originalContentOffset;
///////////////////////////////////////////////////// ///bill's fix on 3.5" view with a navi bar and 5 txtFields self.contentSize = self.frame.size; /////////////////////////////////////////////////////
[self setScrollIndicatorInsets:self.contentInset]; _priorInsetSaved = NO; [UIView commitAnimations]; }
Please correct me if wrong, but in case the original scroll was bigger than the frame (for example you have 30 uitextfields) after the keyboard goes away you won't be able to scroll anymore.
On mar 22, 2013, at 9:48, billchanums [email protected] wrote:
The view has 4 text fields and not higher then the root UIView's size.
I added a line to fix the issue:
(void)keyboardWillHide:(NSNotification*)notification { _keyboardRect = CGRectZero; _keyboardVisible = NO;
// Restore dimensions to prior size [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]]; [UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]]; self.contentInset = _priorInset; self.contentOffset = _originalContentOffset;
///////////////////////////////////////////////////// ///bill's fix on 3.5" view with a navi bar and 5 txtFields self.contentSize = self.frame.size; /////////////////////////////////////////////////////
[self setScrollIndicatorInsets:self.contentInset]; _priorInsetSaved = NO; [UIView commitAnimations]; }
— Reply to this email directly or view it on GitHub.
I believe I find the reason.
before and after this line: self.contentSize = self.frame.size;
(lldb) po self.contentSize.height $0 = 460 no Objective-C description available po self.contentSize.height $1 = 416 [no Objective-C description available]
My storyboard is base on 4"screen, and no "Use Autolayout". 460px is the 4"screen is view size inside the navi controller. I enabled add Autosizing option and no help....
Cheers Bill - would you mind submitting a pull request?
Sent from my iPad
On 22 Mar 2013, at 23:48, billchanums [email protected] wrote:
The view has 4 text fields and not higher then the root UIView's size.
I added a line to fix the issue:
(void)keyboardWillHide:(NSNotification*)notification { _keyboardRect = CGRectZero; _keyboardVisible = NO;
// Restore dimensions to prior size [UIView beginAnimations:nil context:NULL]; [UIView setAnimationCurve:[[[notification userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey] intValue]]; [UIView setAnimationDuration:[[[notification userInfo] objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]]; self.contentInset = _priorInset; self.contentOffset = _originalContentOffset;
///////////////////////////////////////////////////// ///bill's fix e 3.5" view with a navi bar and 5 txtFields self.contentSize = self.frame.size; /////////////////////////////////////////////////////
[self setScrollIndicatorInsets:self.contentInset]; _priorInsetSaved = NO; [UIView commitAnimations]; }
— Reply to this email directly or view it on GitHub.
My fix just work for the case that all textFields can be shown in the frame's bounds. I think a new var called _originalContentSize is need....
I'm having the same issue. Any new developments about this?
Same here!
Same here! Fix?