mirror of
https://github.com/HackPlan/IQKeyboardManager.git
synced 2026-01-12 22:44:22 +08:00
Fixed some scrollView.isScrollEnabled related issues.
This commit is contained in:
@@ -735,6 +735,24 @@ NSInteger const kIQPreviousNextButtonToolbarTag = -1005;
|
||||
while (superScrollView &&
|
||||
(move>0?(move > (-superScrollView.contentOffset.y-superScrollView.contentInset.top)):superScrollView.contentOffset.y>0) )
|
||||
{
|
||||
UIScrollView *nextScrollView = nil;
|
||||
UIScrollView *tempScrollView = (UIScrollView*)[superScrollView superviewOfClassType:[UIScrollView class]];
|
||||
|
||||
//Getting UIScrollView whose scrolling is enabled. // (Bug ID: #285)
|
||||
while (tempScrollView)
|
||||
{
|
||||
if (tempScrollView.isScrollEnabled)
|
||||
{
|
||||
nextScrollView = tempScrollView;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Getting it's superScrollView. // (Enhancement ID: #21, #24)
|
||||
tempScrollView = (UIScrollView*)[tempScrollView superviewOfClassType:[UIScrollView class]];
|
||||
}
|
||||
}
|
||||
|
||||
//Getting lastViewRect.
|
||||
CGRect lastViewRect = [[lastView superview] convertRect:lastView.frame toView:superScrollView];
|
||||
|
||||
@@ -748,7 +766,7 @@ NSInteger const kIQPreviousNextButtonToolbarTag = -1005;
|
||||
//[superScrollView superviewOfClassType:[UIScrollView class]] == nil If processing scrollView is last scrollView in upper hierarchy (there is no other scrollView upper hierrchy.)
|
||||
//shouldOffsetY >= 0 shouldOffsetY must be greater than in order to keep distance from navigationBar (Bug ID: #92)
|
||||
if ([_textFieldView isKindOfClass:[UITextView class]] &&
|
||||
[superScrollView superviewOfClassType:[UIScrollView class]] == nil &&
|
||||
nextScrollView == nil &&
|
||||
(shouldOffsetY >= 0))
|
||||
{
|
||||
CGFloat maintainTopLayout = 0;
|
||||
@@ -792,7 +810,7 @@ NSInteger const kIQPreviousNextButtonToolbarTag = -1005;
|
||||
|
||||
// Getting next lastView & superScrollView.
|
||||
lastView = superScrollView;
|
||||
superScrollView = (UIScrollView*)[lastView superviewOfClassType:[UIScrollView class]];
|
||||
superScrollView = nextScrollView;
|
||||
}
|
||||
|
||||
//Updating contentInset
|
||||
|
||||
@@ -994,7 +994,7 @@ open class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
while let view = superView {
|
||||
|
||||
if (view.isScrollEnabled) {
|
||||
superScrollView = superView
|
||||
superScrollView = view
|
||||
break
|
||||
}
|
||||
else {
|
||||
@@ -1067,6 +1067,18 @@ open class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
//Looping in upper hierarchy until we don't found any scrollView in it's upper hirarchy till UIWindow object.
|
||||
if move > 0 ? (move > (-scrollView.contentOffset.y - scrollView.contentInset.top)) : scrollView.contentOffset.y>0 {
|
||||
|
||||
var tempScrollView = scrollView.superviewOfClassType(UIScrollView.self) as? UIScrollView
|
||||
var nextScrollView : UIScrollView? = nil
|
||||
while let view = tempScrollView {
|
||||
|
||||
if (view.isScrollEnabled) {
|
||||
nextScrollView = view
|
||||
break
|
||||
} else {
|
||||
tempScrollView = view.superviewOfClassType(UIScrollView.self) as? UIScrollView
|
||||
}
|
||||
}
|
||||
|
||||
//Getting lastViewRect.
|
||||
if let lastViewRect = lastView.superview?.convert(lastView.frame, to: scrollView) {
|
||||
|
||||
@@ -1077,11 +1089,11 @@ open class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
shouldOffsetY = min(shouldOffsetY, lastViewRect.origin.y /*-5*/) //-5 is for good UI.//Commenting -5 (Bug ID: #69)
|
||||
|
||||
//[_textFieldView isKindOfClass:[UITextView class]] If is a UITextView type
|
||||
//[superScrollView superviewOfClassType:[UIScrollView class]] == nil If processing scrollView is last scrollView in upper hierarchy (there is no other scrollView upper hierrchy.)
|
||||
//nextScrollView == nil If processing scrollView is last scrollView in upper hierarchy (there is no other scrollView upper hierrchy.)
|
||||
//[_textFieldView isKindOfClass:[UITextView class]] If is a UITextView type
|
||||
//shouldOffsetY >= 0 shouldOffsetY must be greater than in order to keep distance from navigationBar (Bug ID: #92)
|
||||
if textFieldView is UITextView == true &&
|
||||
scrollView.superviewOfClassType(UIScrollView.self) == nil &&
|
||||
nextScrollView == nil &&
|
||||
shouldOffsetY >= 0 {
|
||||
var maintainTopLayout : CGFloat = 0
|
||||
|
||||
@@ -1127,7 +1139,7 @@ open class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
|
||||
// Getting next lastView & superScrollView.
|
||||
lastView = scrollView
|
||||
superScrollView = lastView.superviewOfClassType(UIScrollView.self) as? UIScrollView
|
||||
superScrollView = nextScrollView
|
||||
} else {
|
||||
break
|
||||
}
|
||||
@@ -1136,7 +1148,7 @@ open class IQKeyboardManager: NSObject, UIGestureRecognizerDelegate {
|
||||
//Updating contentInset
|
||||
if let lastScrollViewRect = lastScrollView.superview?.convert(lastScrollView.frame, to: window) {
|
||||
|
||||
let bottom : CGFloat = kbSize.height-keyboardDistanceFromTextField-(window.frame.height-lastScrollViewRect.maxY)
|
||||
let bottom : CGFloat = kbSize.height-newKeyboardDistanceFromTextField-(window.frame.height-lastScrollViewRect.maxY)
|
||||
|
||||
// Update the insets so that the scroll vew doesn't shift incorrectly when the offset is near the bottom of the scroll view.
|
||||
var movedInsets = lastScrollView.contentInset
|
||||
|
||||
Reference in New Issue
Block a user