Skip to content

Commit 4dca234

Browse files
author
molicechen
committed
4.8.0
1 parent 5e47c3b commit 4dca234

File tree

5 files changed

+119
-29
lines changed

5 files changed

+119
-29
lines changed

QMUIKit/QMUICore/QMUICommonDefines.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
#define IOS17_SDK_ALLOWED YES
7777
#endif
7878

79+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000
80+
/// 当前编译使用的 Base SDK 版本为 iOS 18.0 及以上
81+
#define IOS18_SDK_ALLOWED YES
82+
#endif
83+
7984
#pragma mark - Clang
8085

8186
#define ArgumentToString(macro) #macro

QMUIKit/QMUICore/QMUIHelper.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ NS_ASSUME_NONNULL_BEGIN
163163
/// @NEW_DEVICE_CHECKER
164164
@property(class, nonatomic, readonly) BOOL isRegularScreen;
165165

166+
/// iPhone 16 Pro Max
167+
@property(class, nonatomic, readonly) BOOL is69InchScreen;
168+
166169
/// iPhone 14 Pro Max
167170
@property(class, nonatomic, readonly) BOOL is67InchScreenAndiPhone14Later;
168171

@@ -172,6 +175,9 @@ NS_ASSUME_NONNULL_BEGIN
172175
/// iPhone XS Max / 11 Pro Max
173176
@property(class, nonatomic, readonly) BOOL is65InchScreen;
174177

178+
/// iPhone 16 Pro
179+
@property(class, nonatomic, readonly) BOOL is63InchScreen;
180+
175181
/// iPhone 12 / 12 Pro
176182
@property(class, nonatomic, readonly) BOOL is61InchScreenAndiPhone12Later;
177183

@@ -199,9 +205,11 @@ NS_ASSUME_NONNULL_BEGIN
199205
/// iPhone 4
200206
@property(class, nonatomic, readonly) BOOL is35InchScreen;
201207

208+
@property(class, nonatomic, readonly) CGSize screenSizeFor69Inch;
202209
@property(class, nonatomic, readonly) CGSize screenSizeFor67InchAndiPhone14Later;
203210
@property(class, nonatomic, readonly) CGSize screenSizeFor67Inch;
204211
@property(class, nonatomic, readonly) CGSize screenSizeFor65Inch;
212+
@property(class, nonatomic, readonly) CGSize screenSizeFor63Inch;
205213
@property(class, nonatomic, readonly) CGSize screenSizeFor61InchAndiPhone14ProLater;
206214
@property(class, nonatomic, readonly) CGSize screenSizeFor61InchAndiPhone12Later;
207215
@property(class, nonatomic, readonly) CGSize screenSizeFor61Inch;

QMUIKit/QMUICore/QMUIHelper.m

Lines changed: 104 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#import "NSString+QMUI.h"
2121
#import "UIInterface+QMUI.h"
2222
#import "NSObject+QMUI.h"
23+
#import "NSArray+QMUI.h"
2324
#import <AVFoundation/AVFoundation.h>
2425
#import <math.h>
2526
#import <sys/utsname.h>
@@ -317,6 +318,10 @@ + (NSString *)deviceName {
317318
@"iPhone15,5" : @"iPhone 15 Plus",
318319
@"iPhone16,1" : @"iPhone 15 Pro",
319320
@"iPhone16,2" : @"iPhone 15 Pro Max",
321+
@"iPhone17,1" : @"iPhone 16 Pro",
322+
@"iPhone17,2" : @"iPhone 16 Pro Max",
323+
@"iPhone17,3" : @"iPhone 16",
324+
@"iPhone17,4" : @"iPhone 16 Plus",
320325

321326
@"iPad1,1" : @"iPad 1",
322327
@"iPad2,1" : @"iPad 2 (WiFi)",
@@ -389,6 +394,18 @@ + (NSString *)deviceName {
389394
@"iPad13,11" : @"iPad Pro (12.9 inch, 5th generation)",
390395
@"iPad14,1" : @"iPad mini (6th generation)",
391396
@"iPad14,2" : @"iPad mini (6th generation)",
397+
@"iPad14,3" : @"iPad Pro 11 inch 4th Gen",
398+
@"iPad14,4" : @"iPad Pro 11 inch 4th Gen",
399+
@"iPad14,5" : @"iPad Pro 12.9 inch 6th Gen",
400+
@"iPad14,6" : @"iPad Pro 12.9 inch 6th Gen",
401+
@"iPad14,8" : @"iPad Air 6th Gen",
402+
@"iPad14,9" : @"iPad Air 6th Gen",
403+
@"iPad14,10" : @"iPad Air 7th Gen",
404+
@"iPad14,11" : @"iPad Air 7th Gen",
405+
@"iPad16,3" : @"iPad Pro 11 inch 5th Gen",
406+
@"iPad16,4" : @"iPad Pro 11 inch 5th Gen",
407+
@"iPad16,5" : @"iPad Pro 12.9 inch 7th Gen",
408+
@"iPad16,6" : @"iPad Pro 12.9 inch 7th Gen",
392409

393410
@"iPod1,1" : @"iPod touch 1",
394411
@"iPod2,1" : @"iPod touch 2",
@@ -440,6 +457,11 @@ + (NSString *)deviceName {
440457
@"Watch6,16" : @"Apple Watch Series 8 41mm case (GPS+Cellular)",
441458
@"Watch6,17" : @"Apple Watch Series 8 45mm case (GPS+Cellular)",
442459
@"Watch6,18" : @"Apple Watch Ultra",
460+
@"Watch7,1" : @"Apple Watch Series 9 41mm case (GPS)",
461+
@"Watch7,2" : @"Apple Watch Series 9 45mm case (GPS)",
462+
@"Watch7,3" : @"Apple Watch Series 9 41mm case (GPS+Cellular)",
463+
@"Watch7,4" : @"Apple Watch Series 9 45mm case (GPS+Cellular)",
464+
@"Watch7,5" : @"Apple Watch Ultra 2",
443465

444466
@"AudioAccessory1,1" : @"HomePod",
445467
@"AudioAccessory1,2" : @"HomePod",
@@ -542,9 +564,26 @@ + (BOOL)isNotchedScreen {
542564
}
543565

544566
+ (BOOL)isRegularScreen {
567+
if ([@[
568+
@"iPhone 14 Pro",
569+
@"iPhone 15",
570+
@"iPhone 16",
571+
] qmui_firstMatchWithBlock:^BOOL(NSString *item) {
572+
return [QMUIHelper.deviceName hasPrefix:item];
573+
}]) {
574+
return YES;
575+
}
545576
return [self isIPad] || (!IS_ZOOMEDMODE && ([self is67InchScreenAndiPhone14Later] || [self is67InchScreen] || [self is65InchScreen] || [self is61InchScreen] || [self is55InchScreen]));
546577
}
547578

579+
static NSInteger is69InchScreen = -1;
580+
+ (BOOL)is69InchScreen {
581+
if (is69InchScreen < 0) {
582+
is69InchScreen = CGSizeEqualToSize(CGSizeMake(DEVICE_WIDTH, DEVICE_HEIGHT), self.screenSizeFor69Inch) ? 1 : 0;
583+
}
584+
return is69InchScreen > 0;
585+
}
586+
548587
static NSInteger is67InchScreenAndiPhone14Later = -1;
549588
+ (BOOL)is67InchScreenAndiPhone14Later {
550589
if (is67InchScreenAndiPhone14Later < 0) {
@@ -571,6 +610,14 @@ + (BOOL)is65InchScreen {
571610
return is65InchScreen > 0;
572611
}
573612

613+
static NSInteger is63InchScreen = -1;
614+
+ (BOOL)is63InchScreen {
615+
if (is63InchScreen < 0) {
616+
is63InchScreen = CGSizeEqualToSize(CGSizeMake(DEVICE_WIDTH, DEVICE_HEIGHT), self.screenSizeFor63Inch) ? 1 : 0;
617+
}
618+
return is63InchScreen > 0;
619+
}
620+
574621
static NSInteger is61InchScreenAndiPhone14ProLater = -1;
575622
+ (BOOL)is61InchScreenAndiPhone14ProLater {
576623
if (is61InchScreenAndiPhone14ProLater < 0) {
@@ -645,6 +692,10 @@ + (BOOL)is35InchScreen {
645692
return is35InchScreen > 0;
646693
}
647694

695+
+ (CGSize)screenSizeFor69Inch {
696+
return CGSizeMake(440, 956);
697+
}
698+
648699
+ (CGSize)screenSizeFor67InchAndiPhone14Later {
649700
return CGSizeMake(430, 932);// iPhone 14 Pro Max
650701
}
@@ -665,6 +716,10 @@ + (CGSize)screenSizeFor61InchAndiPhone12Later {
665716
return CGSizeMake(390, 844);
666717
}
667718

719+
+ (CGSize)screenSizeFor63Inch {
720+
return CGSizeMake(402, 874);
721+
}
722+
668723
+ (CGSize)screenSizeFor61Inch {
669724
return CGSizeMake(414, 896);
670725
}
@@ -724,6 +779,26 @@ + (UIEdgeInsets)safeAreaInsetsForDeviceWithNotch {
724779
static NSDictionary<NSString *, NSDictionary<NSNumber *, NSValue *> *> *dict;
725780
if (!dict) {
726781
dict = @{
782+
// iPhone 16 Pro
783+
@"iPhone17,1": @{
784+
@(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(62, 0, 34, 0)],
785+
@(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(0, 62, 21, 62)],
786+
},
787+
// iPhone 16 Pro Max
788+
@"iPhone17,2": @{
789+
@(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(62, 0, 34, 0)],
790+
@(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(0, 62, 21, 62)],
791+
},
792+
// iPhone 16
793+
@"iPhone17,3": @{
794+
@(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(59, 0, 34, 0)],
795+
@(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(0, 59, 21, 59)],
796+
},
797+
// iPhone 16 Plus
798+
@"iPhone17,4": @{
799+
@(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(59, 0, 34, 0)],
800+
@(UIInterfaceOrientationLandscapeLeft): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(0, 59, 21, 59)],
801+
},
727802
// iPhone 15
728803
@"iPhone15,4": @{
729804
@(UIInterfaceOrientationPortrait): [NSValue valueWithUIEdgeInsets:UIEdgeInsetsMake(47, 0, 34, 0)],
@@ -960,19 +1035,16 @@ + (BOOL)isZoomedMode {
9601035

9611036
+ (BOOL)isDynamicIslandDevice {
9621037
if (!IS_IPHONE) return NO;
963-
__block BOOL result = NO;
964-
NSString *deviceName = self.deviceName;
965-
[@[
1038+
if ([@[
9661039
@"iPhone 14 Pro",
967-
@"iPhone 14 Pro Max",
9681040
@"iPhone 15",
969-
] enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
970-
if ([deviceName hasPrefix:obj]) {
971-
result = YES;
972-
*stop = YES;
973-
}
974-
}];
975-
return result;
1041+
@"iPhone 16",
1042+
] qmui_firstMatchWithBlock:^BOOL(NSString *item) {
1043+
return [QMUIHelper.deviceName hasPrefix:item];
1044+
}]) {
1045+
return YES;
1046+
}
1047+
return NO;
9761048
}
9771049

9781050
- (void)handleAppSizeWillChange:(NSNotification *)notification {
@@ -1017,13 +1089,13 @@ + (CGFloat)statusBarHeightConstant {
10171089
// iPhone 13 Mini
10181090
return 48;
10191091
}
1020-
if ([deviceModel isEqualToString:@"iPhone15,2"] // iPhone 14 Pro
1021-
|| [deviceModel isEqualToString:@"iPhone15,3"] // iPhone 14 Pro Max
1022-
|| [deviceModel isEqualToString:@"iPhone15,4"] // iPhone 15
1023-
|| [deviceModel isEqualToString:@"iPhone15,5"] // iPhone 15 Plus
1024-
|| [deviceModel isEqualToString:@"iPhone16,1"] // iPhone 15 Pro
1025-
|| [deviceModel isEqualToString:@"iPhone16,2"] // iPhone 15 Pro Max
1026-
) {
1092+
if ([@[
1093+
@"iPhone 14 Pro",
1094+
@"iPhone 15",
1095+
@"iPhone 16",
1096+
] qmui_firstMatchWithBlock:^BOOL(NSString *item) {
1097+
return [QMUIHelper.deviceName hasPrefix:item];
1098+
}]) {
10271099
return 54;
10281100
}
10291101
if (IS_61INCH_SCREEN_AND_IPHONE12 || IS_67INCH_SCREEN) {
@@ -1040,15 +1112,20 @@ + (CGFloat)navigationBarMaxYConstant {
10401112
result += PreferredValueForVisualDevice(44, 32);
10411113
} else {
10421114
result += 44;
1043-
NSString *deviceModel = [QMUIHelper deviceModel];
1044-
if ([deviceModel isEqualToString:@"iPhone15,2"] // iPhone 14 Pro
1045-
|| [deviceModel isEqualToString:@"iPhone15,3"] // iPhone 14 Pro Max
1046-
|| [deviceModel isEqualToString:@"iPhone15,4"] // iPhone 15
1047-
|| [deviceModel isEqualToString:@"iPhone15,5"] // iPhone 15 Plus
1048-
|| [deviceModel isEqualToString:@"iPhone16,1"] // iPhone 15 Pro
1049-
|| [deviceModel isEqualToString:@"iPhone16,2"] // iPhone 15 Pro Max
1050-
) {
1051-
result -= PixelOne;
1115+
if ([@[
1116+
@"iPhone 16 Pro",
1117+
] qmui_firstMatchWithBlock:^BOOL(NSString *item) {
1118+
return [QMUIHelper.deviceName hasPrefix:item];
1119+
}]) {
1120+
result += 2 + PixelOne;// 56.333
1121+
} else if ([@[
1122+
@"iPhone 14 Pro",
1123+
@"iPhone 15",
1124+
@"iPhone 16",
1125+
] qmui_firstMatchWithBlock:^BOOL(NSString *item) {
1126+
return [QMUIHelper.deviceName hasPrefix:item];
1127+
}]) {
1128+
result -= PixelOne;// 53.667
10521129
}
10531130
}
10541131
return result;

QMUIKit/QMUICore/QMUIRuntime.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static BOOL strendswith(const char *str, const char *suffix) {
169169
NSString *executablePath = NSBundle.mainBundle.executablePath;
170170
if (!executablePath) return nil;
171171
const headerType *target_image_header = 0;
172-
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000
172+
#ifdef IOS18_SDK_ALLOWED
173173
#if DEBUG
174174
// Xcode16之后,优先查找debug.dylib
175175
NSString *debugImagePath = [NSString stringWithFormat:@"%@.debug.dylib", executablePath];

QMUIKit/UIKitExtensions/UITableView+QMUI.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ + (void)load {
9393
};
9494
});
9595

96-
// [UIKit Bug] iOS 14 及以下版本,将 UISearchBar 作为 tableHeaderView 使用的 UITableView,如果同时设置了 estimatedRowHeight,则 contentSize 会错乱,导致滚动异常
96+
// [UIKit Bug] 将 UISearchBar 作为 tableHeaderView 使用的 UITableView,如果同时设置了 estimatedRowHeight,则 contentSize 会错乱,导致滚动异常
9797
// https://github.com/Tencent/QMUI_iOS/issues/1161
9898
if (@available(iOS 15.0, *)) {
9999
} else {

0 commit comments

Comments
 (0)