We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xcode Version:14.0 (14A309) iOS Version:16.0 模拟器:iPhone 14 Pro、iPhone 14 Pro Max WRNavigationBar Version:1.4.0(16 Jul 2021)
iPhone竖屏状态下,“灵动岛”状态栏高度:54pt 目前带“灵动岛”的机型,状态栏+导航栏的高度有异常
带“灵动岛”的机型,状态栏+导航栏的高度理论值为54pt+44pt=98pt 该库展示的状态栏+导航栏的高度小于98pt
还请大佬有时间适配一下
The text was updated successfully, but these errors were encountered:
@wangrui460 我先用一个临时方法兼容着,期待大佬能从源代码上适配“灵动岛”
#import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN @interface UINavigationBar (dynamic_island) @end NS_ASSUME_NONNULL_END
#import "UINavigationBar+dynamic_island.h" #import <objc/runtime.h> @implementation UINavigationBar (dynamic_island) +(void)initialize { static dispatch_once_t token; dispatch_once(&token, ^{ //backgroundViewFrame SEL orginSel = NSSelectorFromString(@"backgroundViewFrame"); SEL overrideSel = @selector(newBackgroundViewFrame); Method originMethod = class_getInstanceMethod([self class], orginSel); Method overrideMethod = class_getInstanceMethod([self class], overrideSel); //原来的类没有实现指定的方法,那么我们就得先做判断,把方法添加进去,然后进行替换 if (class_addMethod([self class], orginSel, method_getImplementation(overrideMethod) , method_getTypeEncoding(originMethod))) { class_replaceMethod([self class], overrideSel, method_getImplementation(originMethod), method_getTypeEncoding(originMethod)); }else{ //交换实现 method_exchangeImplementations(originMethod, overrideMethod); } }); } - (CGRect) newBackgroundViewFrame { [self newBackgroundViewFrame]; //根据真实的状态栏高度来计算 CGRect barFrame = self.frame; CGFloat height = barFrame.origin.y + barFrame.size.height; CGRect rect = CGRectMake(0, 0, self.bounds.size.width, height); if (@available(iOS 16.0, *)) { if([UIApplication sharedApplication].statusBarFrame.size.height >= 54){//有灵动岛的机型 rect = CGRectMake(0, 5, self.bounds.size.width, height+1); } } return rect; } @end
Sorry, something went wrong.
No branches or pull requests
Xcode Version:14.0 (14A309)
iOS Version:16.0
模拟器:iPhone 14 Pro、iPhone 14 Pro Max
WRNavigationBar Version:1.4.0(16 Jul 2021)
iPhone竖屏状态下,“灵动岛”状态栏高度:54pt
目前带“灵动岛”的机型,状态栏+导航栏的高度有异常
带“灵动岛”的机型,状态栏+导航栏的高度理论值为54pt+44pt=98pt
该库展示的状态栏+导航栏的高度小于98pt
还请大佬有时间适配一下
The text was updated successfully, but these errors were encountered: