- July 26, 2025
- Mins Read
iOS utility class allows you to access keyboard view and track keyboard animation.
(It was used by YYText)
iPhone / iPad / iPod with iOS 6~11.
// Get keyboard manager
YYKeyboardManager *manager = [YYKeyboardManager defaultManager];
// Get keyboard view and window
UIView *view = manager.keyboardView;
UIWindow *window = manager.keyboardWindow;
// Get keyboard status
BOOL visible = manager.keyboardVisible;
CGRect frame = manager.keyboardFrame;
frame = [manager convertRect:frame toView:self.view];
// Track keyboard animation
[manager addObserver:self];
– (void)keyboardChangedWithTransition:(YYKeyboardTransition)transition {
CGRect fromFrame = [manager convertRect:transition.fromFrame toView:self.view];
CGRect toFrame = [manager convertRect:transition.toFrame toView:self.view];
BOOL fromVisible = transition.fromVisible;
BOOL toVisible = transition.toVisible;
NSTimeInterval animationDuration = transition.animationDuration;
UIViewAnimationCurve curve = transition.animationCurve;
}
pod 'YYKeyboardManager'
to your Podfile.pod install
or pod update
.github "ibireme/YYKeyboardManager"
to your Cartfile.carthage update --platform ios
and add the framework to your project.YYKeyboardManager.h
.Full API documentation is available on CocoaDocs.
You can also install documentation locally using appledoc.
This library requires iOS 6.0+
and Xcode 8.0+
.
YYKeyboardManager is provided under the MIT license. See LICENSE file for details.
iOS 键盘监听管理工具类。
(该工具是从 YYText 提取出来的独立组件)
该项目能很好的兼容 iPhone / iPad / iPod,兼容 iOS 6~11, 并且能很好的处理屏幕旋转。
// 获取键盘管理器
YYKeyboardManager *manager = [YYKeyboardManager defaultManager];
// 获取键盘的 view 和 window
UIView *view = manager.keyboardView;
UIWindow *window = manager.keyboardWindow;
// 获取键盘当前状态
BOOL visible = manager.keyboardVisible;
CGRect frame = manager.keyboardFrame;
frame = [manager convertRect:frame toView:self.view];
// 监听键盘动画
[manager addObserver:self];
– (void)keyboardChangedWithTransition:(YYKeyboardTransition)transition {
CGRect fromFrame = [manager convertRect:transition.fromFrame toView:self.view];
CGRect toFrame = [manager convertRect:transition.toFrame toView:self.view];
BOOL fromVisible = transition.fromVisible;
BOOL toVisible = transition.toVisible;
NSTimeInterval animationDuration = transition.animationDuration;
UIViewAnimationCurve curve = transition.animationCurve;
}
NavigationKit is a lightweight library which makes SwiftUI navigation super easy to use. 💻 Installation 📦 Swift Package Manager Using Swift Package Manager, add ...
An alternative SwiftUI NavigationView implementing classic stack-based navigation giving also some more control on animations and programmatic navigation. NavigationStack Installation ...
With SwiftUI Router you can power your SwiftUI app with path-based routing. By utilizing a path-based system, navigation in your app becomes ...
This package takes SwiftUI's familiar and powerful NavigationStack API and gives it superpowers, allowing you to use the same API not just ...