Comments (3)
This problem is resolved when a UIStackView exists between the UITextField and the UITableView.
How can I solve this problem without adding UIStackView.
UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in
let animatedContentOffset = textFieldView.superviewOfClassType(UIStackView.self, belowView: scrollView) != nil // (Bug ID: #1365, #1508, #1541)
if animatedContentOffset {
scrollView.setContentOffset(newContentOffset, animated: UIView.areAnimationsEnabled)
} else {
scrollView.contentOffset = newContentOffset
}
}, completion: { _ in
if scrollView is UITableView || scrollView is UICollectionView {
//This will update the next/previous states
self.addToolbarIfRequired()
}
})
This code may be causing the malfunction
from iqkeyboardmanager.
I found out that it's due to animatedContentOffset and it depends on the UIStackView. The condition is there because of (Bug ID: #1365, #1508, #1541).
I also found out that when keyboard resign the same problem happen due to below code:-
UIView.animate(withDuration: animationDuration, delay: 0, options: animationCurve, animations: { () -> Void in
if lastScrollView.contentInset != self.startingContentInsets {
self.showLog("Restoring contentInset to: \(self.startingContentInsets)")
lastScrollView.contentInset = self.startingContentInsets
lastScrollView.scrollIndicatorInsets = self.startingScrollIndicatorInsets
}
if lastScrollView.shouldRestoreScrollViewContentOffset, !lastScrollView.contentOffset.equalTo(self.startingContentOffset) {
self.showLog("Restoring contentOffset to: \(self.startingContentOffset)")
let animatedContentOffset = self.textFieldView?.superviewOfClassType(UIStackView.self, belowView: lastScrollView) != nil // (Bug ID: #1365, #1508, #1541)
if animatedContentOffset {
lastScrollView.setContentOffset(self.startingContentOffset, animated: UIView.areAnimationsEnabled)
} else {
lastScrollView.contentOffset = self.startingContentOffset
}
}
//...
})
When I debugged more, I found out that changing contentInset is producing weird behavior, but it's there for a reason and we can't remove it from there.
from iqkeyboardmanager.
I have added two more conditions there one is for UICollectionView and another one is for UITableView, so if it's there then setContentOffset function will be used. This fixed the animation when keyboard appears.
from iqkeyboardmanager.
Related Issues (20)
- iOS17 privacy policy HOT 5
- Xcode 15.2: Carthage build task fail with exit code 65 HOT 1
- additional bottom gap between the last input box and the keyboard HOT 1
- disabledToolbarClasses , enableAutoToolbar - are not verified before call func addToolbarIfRequired() HOT 1
- Jumping content for the first time HOT 1
- disable IQKeyboardManager inside swiftui HOT 2
- crash [UIView(IQToolbarAddition) addKeyboardToolbarWithTarget:titleText:rightBarButtonConfiguration:previousBarButtonConfiguration:nextBarButtonConfiguration:] HOT 1
- Upload Privacy Policy HOT 1
- privacy manifest for major version 6 HOT 4
- Reference that makes memory leak HOT 4
- IQKeyboardManager version 6.5.18 privacy manifest is different with master HOT 1
- Aviator HOT 1
- Aviator
- Keyboard space is not removing insets from the ScrollView correctly HOT 1
- Aviator
- Unable to change done button text HOT 1
- parentContainerViewController case Page jam HOT 1
- Layout breaks after updating to 6.5.15+ HOT 3
- IQKeyboardManager中1112行,没有判断是否开启工具栏 导致用户设置工具栏隐藏时还是会意外显示出来
- KeyboardDistanceFromTextField设置10,实际距离差不多能达到100以上
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iqkeyboardmanager.