Skip to content

Commit 0ee53a9

Browse files
authored
Merge branch 'master' into master
2 parents 61b4309 + 0e7d274 commit 0ee53a9

File tree

60 files changed

+1026
-510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1026
-510
lines changed

QMUIKit.podspec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QMUIKit"
3-
s.version = "4.4.3"
3+
s.version = "4.5.0"
44
s.summary = "致力于提高项目 UI 开发效率的解决方案"
55
s.description = <<-DESC
66
QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。
@@ -41,6 +41,11 @@ Pod::Spec.new do |s|
4141

4242
s.subspec 'QMUIResources' do |ss|
4343
ss.resource_bundles = {'QMUIResources' => ['QMUIKit/QMUIResources/*.*']}
44+
ss.pod_target_xcconfig = {
45+
'EXPANDED_CODE_SIGN_IDENTITY' => '',
46+
'CODE_SIGNING_REQUIRED' => 'NO',
47+
'CODE_SIGNING_ALLOWED' => 'NO',
48+
}
4449
end
4550

4651
s.subspec 'QMUIWeakObjectContainer' do |ss|

QMUIKit/QMUIComponents/NavigationBarTransition/UINavigationBar+Transition.m

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import "UINavigationBar+Transition.h"
1717
#import "QMUICore.h"
1818
#import "UINavigationBar+QMUI.h"
19+
#import "UINavigationBar+QMUIBarProtocol.h"
1920
#import "QMUIWeakObjectContainer.h"
2021
#import "UIImage+QMUI.h"
2122

@@ -53,17 +54,53 @@ + (void)load {
5354
}
5455
});
5556

56-
ExtendImplementationOfVoidMethodWithTwoArguments([UINavigationBar class], @selector(setBackgroundImage:forBarMetrics:), UIImage *, UIBarMetrics, ^(UINavigationBar *selfObject, UIImage *backgroundImage, UIBarMetrics barMetrics) {
57-
if (selfObject.qmuinb_copyStylesToBar) {
58-
[selfObject.qmuinb_copyStylesToBar setBackgroundImage:backgroundImage forBarMetrics:barMetrics];
59-
}
57+
OverrideImplementation([UINavigationBar class], @selector(setBackgroundImage:forBarPosition:barMetrics:), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
58+
return ^(UINavigationBar *selfObject, UIImage *image, UIBarPosition barPosition, UIBarMetrics barMetrics) {
59+
60+
// call super
61+
void (*originSelectorIMP)(id, SEL, UIImage *, UIBarPosition, UIBarMetrics);
62+
originSelectorIMP = (void (*)(id, SEL, UIImage *, UIBarPosition, UIBarMetrics))originalIMPProvider();
63+
originSelectorIMP(selfObject, originCMD, image, barPosition, barMetrics);
64+
65+
if (selfObject.qmuinb_copyStylesToBar) {
66+
[selfObject.qmuinb_copyStylesToBar setBackgroundImage:image forBarPosition:barPosition barMetrics:barMetrics];
67+
}
68+
};
6069
});
6170

6271
ExtendImplementationOfVoidMethodWithSingleArgument([UINavigationBar class], @selector(setShadowImage:), UIImage *, ^(UINavigationBar *selfObject, UIImage *firstArgv) {
6372
if (selfObject.qmuinb_copyStylesToBar) {
6473
selfObject.qmuinb_copyStylesToBar.shadowImage = firstArgv;
6574
}
6675
});
76+
77+
OverrideImplementation([UINavigationBar class], @selector(setQmui_effect:), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
78+
return ^(UINavigationBar *selfObject, UIBlurEffect *firstArgv) {
79+
80+
// call super
81+
void (*originSelectorIMP)(id, SEL, UIBlurEffect *);
82+
originSelectorIMP = (void (*)(id, SEL, UIBlurEffect *))originalIMPProvider();
83+
originSelectorIMP(selfObject, originCMD, firstArgv);
84+
85+
if (selfObject.qmuinb_copyStylesToBar) {
86+
selfObject.qmuinb_copyStylesToBar.qmui_effect = firstArgv;
87+
}
88+
};
89+
});
90+
91+
OverrideImplementation([UINavigationBar class], @selector(setQmui_effectForegroundColor:), ^id(__unsafe_unretained Class originClass, SEL originCMD, IMP (^originalIMPProvider)(void)) {
92+
return ^(UINavigationBar *selfObject, UIColor *firstArgv) {
93+
94+
// call super
95+
void (*originSelectorIMP)(id, SEL, UIColor *);
96+
originSelectorIMP = (void (*)(id, SEL, UIColor *))originalIMPProvider();
97+
originSelectorIMP(selfObject, originCMD, firstArgv);
98+
99+
if (selfObject.qmuinb_copyStylesToBar) {
100+
selfObject.qmuinb_copyStylesToBar.qmui_effectForegroundColor = firstArgv;
101+
}
102+
};
103+
});
67104
});
68105
}
69106

@@ -105,9 +142,13 @@ - (void)setQmuinb_copyStylesToBar:(UINavigationBar *)copyStylesToBar {
105142
if (![copyStylesToBar.barTintColor isEqual:self.barTintColor]) {
106143
copyStylesToBar.barTintColor = self.barTintColor;
107144
}
145+
108146
#ifdef IOS15_SDK_ALLOWED
109147
}
110148
#endif
149+
150+
copyStylesToBar.qmui_effect = self.qmui_effect;
151+
copyStylesToBar.qmui_effectForegroundColor = self.qmui_effectForegroundColor;
111152
}
112153

113154
- (UINavigationBar *)qmuinb_copyStylesToBar {

QMUIKit/QMUIComponents/NavigationBarTransition/UINavigationController+NavigationBarTransition.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#import "UINavigationBar+Transition.h"
2323
#import "QMUINavigationTitleView.h"
2424
#import "UINavigationBar+QMUI.h"
25+
#import "UINavigationBar+QMUIBarProtocol.h"
2526
#import "UIView+QMUI.h"
2627
#import "QMUILog.h"
2728

@@ -260,6 +261,7 @@ - (void)layoutTransitionNavigationBar {
260261
UIView *backgroundView = self.navigationController.navigationBar.qmui_backgroundView;
261262
CGRect rect = [backgroundView.superview convertRect:backgroundView.frame toView:self.view];
262263
self.transitionNavigationBar.frame = CGRectSetX(rect, 0);// push/pop 过程中系统的导航栏转换过来的 x 可能是 112、-112
264+
[self.view bringSubviewToFront:self.transitionNavigationBar];// 避免在后续被其他 subviews 盖住
263265
}
264266
}
265267

QMUIKit/QMUIComponents/QMUIAlertController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ - (void)viewDidLayoutSubviews {
625625
self.buttonScrollView.contentSize = CGSizeMake(CGRectGetWidth(self.buttonScrollView.bounds), contentOriginY);
626626
// 容器最后布局
627627
CGFloat contentHeight = CGRectGetHeight(self.headerScrollView.bounds) + CGRectGetHeight(self.buttonScrollView.bounds);
628-
CGFloat screenSpaceHeight = CGRectGetHeight(self.view.bounds);
628+
CGFloat screenSpaceHeight = CGRectGetHeight(self.view.bounds) - UIEdgeInsetsGetVerticalValue(SafeAreaInsetsConstantForDeviceWithNotch);
629629
if (contentHeight > screenSpaceHeight - 20) {
630630
screenSpaceHeight -= 20;
631631
CGFloat contentH = fmin(CGRectGetHeight(self.headerScrollView.bounds), screenSpaceHeight / 2);
@@ -649,7 +649,7 @@ - (void)viewDidLayoutSubviews {
649649
self.scrollWrapView.frame = CGRectMake(0, 0, CGRectGetWidth(self.scrollWrapView.bounds), contentHeight);
650650
self.mainVisualEffectView.frame = self.scrollWrapView.bounds;
651651

652-
self.containerView.qmui_frameApplyTransform = CGRectMake((CGRectGetWidth(self.view.bounds) - CGRectGetWidth(self.containerView.frame)) / 2, (screenSpaceHeight - contentHeight - self.keyboardHeight) / 2, CGRectGetWidth(self.containerView.frame), CGRectGetHeight(self.scrollWrapView.bounds));
652+
self.containerView.qmui_frameApplyTransform = CGRectMake((CGRectGetWidth(self.view.bounds) - CGRectGetWidth(self.containerView.frame)) / 2, SafeAreaInsetsConstantForDeviceWithNotch.top + (screenSpaceHeight - contentHeight - self.keyboardHeight) / 2, CGRectGetWidth(self.containerView.frame), CGRectGetHeight(self.scrollWrapView.bounds));
653653
}
654654

655655
else if (self.preferredStyle == QMUIAlertControllerStyleActionSheet) {

QMUIKit/QMUIComponents/QMUIButton/QMUIButton.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#import "QMUIButton.h"
1717
#import "QMUICore.h"
18-
#import "QMUILog.h"
1918
#import "CALayer+QMUI.h"
2019
#import "UIButton+QMUI.h"
2120

QMUIKit/QMUIComponents/QMUIButton/QMUINavigationButton.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#import "UIColor+QMUI.h"
2020
#import "UIViewController+QMUI.h"
2121
#import "QMUINavigationController.h"
22-
#import "QMUILog.h"
2322
#import "UIControl+QMUI.h"
2423
#import "UIView+QMUI.h"
2524
#import "NSString+QMUI.h"

QMUIKit/QMUIComponents/QMUIConsole/QMUIConsole.m

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,37 @@
2121
#import "UIColor+QMUI.h"
2222
#import "QMUITextView.h"
2323

24+
/// 定义一个 class 只是为了在 Lookin 里表达这是一个 console window 而已,不需要实现什么东西
25+
@interface QMUIConsoleWindow : UIWindow
26+
@end
27+
28+
@implementation QMUIConsoleWindow
29+
30+
- (instancetype)init {
31+
if (self = [super init]) {
32+
self.backgroundColor = nil;
33+
if (QMUICMIActivated) {
34+
self.windowLevel = UIWindowLevelQMUIConsole;
35+
} else {
36+
self.windowLevel = 1;
37+
}
38+
self.qmui_capturesStatusBarAppearance = NO;
39+
}
40+
return self;
41+
}
42+
43+
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
44+
// 当显示 QMUIConsole 时,点击空白区域,consoleViewController hitTest 会 return nil,从而将事件传递给 window,再由 window hitTest return nil 来把事件传递给 UIApplication.delegate.window。但在 iPad 12-inch 里,当 consoleViewController hitTest return nil 后,事件会错误地传递给 consoleViewController.view.superview(而不是 consoleWindow),不清楚原因,暂时做一下保护
45+
// https://github.com/Tencent/QMUI_iOS/issues/1169
46+
UIView *originalView = [super hitTest:point withEvent:event];
47+
return originalView == self || originalView == self.rootViewController.view.superview ? nil : originalView;
48+
}
49+
50+
@end
51+
2452
@interface QMUIConsole ()
2553

26-
@property(nonatomic, strong) UIWindow *consoleWindow;
54+
@property(nonatomic, strong) QMUIConsoleWindow *consoleWindow;
2755
@property(nonatomic, strong) QMUIConsoleViewController *consoleViewController;
2856
@end
2957

@@ -65,6 +93,7 @@ + (id)allocWithZone:(struct _NSZone *)zone{
6593

6694
+ (void)logWithLevel:(NSString *)level name:(NSString *)name logString:(id)logString {
6795
QMUIConsole *console = [QMUIConsole sharedInstance];
96+
if (!QMUIConsole.sharedInstance.canShow) return;
6897
[console initConsoleWindowIfNeeded];
6998
[console.consoleViewController logWithLevel:level name:name logString:logString];
7099
if (console.showConsoleAutomatically) {
@@ -105,21 +134,7 @@ + (void)hide {
105134

106135
- (void)initConsoleWindowIfNeeded {
107136
if (!self.consoleWindow) {
108-
self.consoleWindow = [[UIWindow alloc] init];
109-
self.consoleWindow.backgroundColor = nil;
110-
if (QMUICMIActivated) {
111-
self.consoleWindow.windowLevel = UIWindowLevelQMUIConsole;
112-
} else {
113-
self.consoleWindow.windowLevel = 1;
114-
}
115-
self.consoleWindow.qmui_capturesStatusBarAppearance = NO;
116-
__weak __typeof(self)weakSelf = self;
117-
self.consoleWindow.qmui_hitTestBlock = ^__kindof UIView * _Nonnull(CGPoint point, UIEvent * _Nonnull event, __kindof UIView * _Nonnull originalView) {
118-
// 当显示 QMUIConsole 时,点击空白区域,consoleViewController hitTest 会 return nil,从而将事件传递给 window,再由 window hitTest return nil 来把事件传递给 UIApplication.delegate.window。但在 iPad 12-inch 里,当 consoleViewController hitTest return nil 后,事件会错误地传递给 consoleViewController.view.superview(而不是 consoleWindow),不清楚原因,暂时做一下保护
119-
// https://github.com/Tencent/QMUI_iOS/issues/1169
120-
return originalView == weakSelf.consoleWindow || originalView == weakSelf.consoleViewController.view.superview ? nil : originalView;
121-
};
122-
137+
self.consoleWindow = [[QMUIConsoleWindow alloc] init];
123138
self.consoleViewController = [[QMUIConsoleViewController alloc] init];
124139
self.consoleWindow.rootViewController = self.consoleViewController;
125140
}

QMUIKit/QMUIComponents/QMUIConsole/QMUIConsoleViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ @implementation QMUIConsoleLogItemCell
103103

104104
- (void)didInitializeWithStyle:(UITableViewCellStyle)style {
105105
[super didInitializeWithStyle:style];
106-
self.backgroundColor = nil;
106+
self.backgroundColor = UIColor.clearColor;
107107
self.selectionStyle = UITableViewCellSelectionStyleNone;
108108

109109
self.textView = [[QMUITextView alloc] init];

QMUIKit/QMUIComponents/QMUIDialogViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,8 @@ - (void)didInitialize {
450450
self.selectedItemIndexes = [[NSMutableSet alloc] init];
451451

452452
self.tableView = [[QMUITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
453-
self.tableView.delegate = self;
454453
self.tableView.dataSource = self;
454+
self.tableView.delegate = self;
455455
self.tableView.alwaysBounceVertical = NO;
456456
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
457457

QMUIKit/QMUIComponents/QMUIImagePreviewView/QMUIImagePreviewView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ - (void)didInitializedWithFrame:(CGRect)frame {
8383
self.collectionViewLayout.allowsMultipleItemScroll = NO;
8484

8585
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMakeWithSize(frame.size) collectionViewLayout:self.collectionViewLayout];
86-
self.collectionView.delegate = self;
8786
self.collectionView.dataSource = self;
87+
self.collectionView.delegate = self;
8888
self.collectionView.backgroundColor = UIColorClear;
8989
self.collectionView.showsHorizontalScrollIndicator = NO;
9090
self.collectionView.showsVerticalScrollIndicator = NO;

0 commit comments

Comments
 (0)