Skip to content

Commit 54dc8d0

Browse files
author
molicechen
committed
4.6.1 - 最低支持版本上升到 iOS 13.0
1 parent 0fa7d9e commit 54dc8d0

Some content is hidden

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

49 files changed

+738
-1586
lines changed

QMUIConfigurationTemplate/QMUIConfigurationTemplate.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,21 +276,18 @@ - (void)applyConfigurationTemplate {
276276
QMUICMI.automaticCustomNavigationBarTransitionStyle = NO; // AutomaticCustomNavigationBarTransitionStyle : 界面 push/pop 时是否要自动根据两个界面的 barTintColor/backgroundImage/shadowImage 的样式差异来决定是否使用自定义的导航栏效果
277277
QMUICMI.supportedOrientationMask = UIInterfaceOrientationMaskAll; // SupportedOrientationMask : 默认支持的横竖屏方向
278278
QMUICMI.automaticallyRotateDeviceOrientation = NO; // AutomaticallyRotateDeviceOrientation : 是否在界面切换或 viewController.supportedOrientationMask 发生变化时自动旋转屏幕(仅 iOS 15 及以前版本需要,iOS 16 系统会自动处理,该开关无意义。)
279-
QMUICMI.defaultStatusBarStyle = UIStatusBarStyleDefault; // DefaultStatusBarStyle : 默认的状态栏样式,默认值为 UIStatusBarStyleDefault,也即在 iOS 12 及以前是黑色文字,iOS 13 及以后会自动根据当前 App 是否处于 Dark Mode 切换颜色。如果你希望固定为白色,请设置为 UIStatusBarStyleLightContent,固定黑色则设置为 QMUIStatusBarStyleDarkContent
279+
QMUICMI.defaultStatusBarStyle = UIStatusBarStyleDefault; // DefaultStatusBarStyle : 默认的状态栏样式,默认值为 UIStatusBarStyleDefault,也即在 iOS 12 及以前是黑色文字,iOS 13 及以后会自动根据当前 App 是否处于 Dark Mode 切换颜色。如果你希望固定为白色,请设置为 UIStatusBarStyleLightContent,固定黑色则设置为 UIStatusBarStyleDarkContent
280280
QMUICMI.needsBackBarButtonItemTitle = YES; // NeedsBackBarButtonItemTitle : 全局是否需要返回按钮的 title,不需要则只显示一个返回image
281281
QMUICMI.hidesBottomBarWhenPushedInitially = NO; // HidesBottomBarWhenPushedInitially : QMUICommonViewController.hidesBottomBarWhenPushed 的初始值,默认为 NO,以保持与系统默认值一致,但通常建议改为 YES,因为一般只有 tabBar 首页那几个界面要求为 NO
282282
QMUICMI.preventConcurrentNavigationControllerTransitions = YES; // PreventConcurrentNavigationControllerTransitions : 自动保护 QMUINavigationController 在上一次 push/pop 尚未结束的时候就进行下一次 push/pop 的行为,避免产生 crash
283283
QMUICMI.navigationBarHiddenInitially = NO; // NavigationBarHiddenInitially : QMUINavigationControllerDelegate preferredNavigationBarHidden 的初始值,默认为NO
284-
QMUICMI.shouldFixTabBarTransitionBugInIPhoneX = NO; // ShouldFixTabBarTransitionBugInIPhoneX : 是否需要自动修复 iOS 11 下,iPhone X 的设备在 push 界面时,tabBar 会瞬间往上跳的 bug
285284
QMUICMI.shouldFixTabBarSafeAreaInsetsBug = NO; // ShouldFixTabBarSafeAreaInsetsBug : 是否要对 iOS 11 及以后的版本修复当存在 UITabBar 时,UIScrollView 的 inset.bottom 可能错误的 bug(issue #218 #934),默认为 YES
286285
QMUICMI.shouldFixSearchBarMaskViewLayoutBug = NO; // ShouldFixSearchBarMaskViewLayoutBug : 是否自动修复 UISearchController.searchBar 被当作 tableHeaderView 使用时可能出现的布局 bug(issue #950)
287286
QMUICMI.shouldPrintQMUIWarnLogToConsole = IS_DEBUG; // ShouldPrintQMUIWarnLogToConsole : 是否在出现 QMUILogWarn 时自动把这些 log 以 QMUIConsole 的方式显示到设备屏幕上
288287
QMUICMI.sendAnalyticsToQMUITeam = YES; // SendAnalyticsToQMUITeam : 是否允许在 DEBUG 模式下上报 Bundle Identifier 和 Display Name 给 QMUI 统计用
289288
QMUICMI.dynamicPreferredValueForIPad = NO; // DynamicPreferredValueForIPad : 当 iPad 处于 Slide Over 或 Split View 分屏模式下,宏 `PreferredValueForXXX` 是否把 iPad 视为某种屏幕宽度近似的 iPhone 来取值。
290-
if (@available(iOS 13.0, *)) {
291-
QMUICMI.ignoreKVCAccessProhibited = NO; // IgnoreKVCAccessProhibited : 是否全局忽略 iOS 13 对 KVC 访问 UIKit 私有属性的限制
292-
QMUICMI.adjustScrollIndicatorInsetsByContentInsetAdjustment = NO; // AdjustScrollIndicatorInsetsByContentInsetAdjustment : 当将 UIScrollView.contentInsetAdjustmentBehavior 设为 UIScrollViewContentInsetAdjustmentNever 时,是否自动将 UIScrollView.automaticallyAdjustsScrollIndicatorInsets 设为 NO,以保证原本在 iOS 12 下的代码不用修改就能在 iOS 13 下正常控制滚动条的位置。
293-
}
289+
QMUICMI.ignoreKVCAccessProhibited = NO; // IgnoreKVCAccessProhibited : 是否全局忽略 iOS 13 对 KVC 访问 UIKit 私有属性的限制
290+
QMUICMI.adjustScrollIndicatorInsetsByContentInsetAdjustment = NO; // AdjustScrollIndicatorInsetsByContentInsetAdjustment : 当将 UIScrollView.contentInsetAdjustmentBehavior 设为 UIScrollViewContentInsetAdjustmentNever 时,是否自动将 UIScrollView.automaticallyAdjustsScrollIndicatorInsets 设为 NO,以保证原本在 iOS 12 下的代码不用修改就能在 iOS 13 下正常控制滚动条的位置。
294291
}
295292

296293
// QMUI 2.3.0 版本里,配置表新增这个方法,返回 YES 表示在 App 启动时要自动应用这份配置表。仅当你的 App 里存在多份配置表时,才需要把除默认配置表之外的其他配置表的返回值改为 NO。

QMUIKit.podspec

Lines changed: 2 additions & 2 deletions
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.6.0"
3+
s.version = "4.6.1"
44
s.summary = "致力于提高项目 UI 开发效率的解决方案"
55
s.description = <<-DESC
66
QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
1515
s.documentation_url = 'https://qmuiteam.com/ios/page/document.html'
1616
s.screenshot = 'https://cloud.githubusercontent.com/assets/1190261/26751376/63f96538-486a-11e7-81cf-5bc83a945207.png'
1717

18-
s.platform = :ios, '11.0'
18+
s.platform = :ios, '13.0'
1919
s.frameworks = 'Foundation', 'UIKit', 'CoreGraphics'
2020
s.preserve_paths = 'QMUIConfigurationTemplate/*'
2121
s.source_files = 'QMUIKit/QMUIKit.h'

QMUIKit/QMUIComponents/NavigationBarTransition/UINavigationController+NavigationBarTransition.m

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,6 @@ + (void)load {
134134
weakNavigationController.navigationBar.qmuinb_copyStylesToBar = nil;
135135
}
136136
break;
137-
case QMUINavigationActionDidPop: {
138-
139-
if (@available(iOS 13.0, *)) {
140-
} else {
141-
// iOS 12 及以下系统,在不使用自定义 titleView 的情况下,在 viewWillAppear 时通过修改 navigationBar.titleTextAttributes 来设置新界面的导航栏标题样式,push 时是生效的,但 pop 时右边界面的样式会覆盖左边界面的样式,所以 pop 时的 titleTextAttributes 改为在 did pop 时处理
142-
// 如果用自定义 titleView 则没这种问题,只是为了代码简单,时机的选择不区分是否自定义 title
143-
[appearingViewController renderNavigationBarTitleAppearanceAnimated:animated];
144-
[weakNavigationController qmui_animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
145-
// 这里要重新获取 topViewController,因为触发 pop 有两种:1. 普通完整的 pop;2.手势返回又取消。后者在 completion 里拿到的 topViewController 已经不是 completion 外面那个 appearingViewController 了,只有重新获取的 topViewController 才能代表最终可视的那个界面
146-
// https://github.com/Tencent/QMUI_iOS/issues/1210
147-
[weakNavigationController.topViewController renderNavigationBarTitleAppearanceAnimated:animated];
148-
}];
149-
}
150-
}
151-
break;
152-
153137
default:
154138
break;
155139
}
@@ -404,16 +388,7 @@ - (void)renderNavigationBarAppearanceAnimated:(BOOL)animated {
404388
// iOS 13 及以上,title 的更新只在 viewWillAppear 这里进行就可以了,但 iOS 12 及以下还要靠 popViewController 那边
405389
// iOS 12 及以下系统,在不使用自定义 titleView 的情况下,在 viewWillAppear 时通过修改 navigationBar.titleTextAttributes 来设置新界面的导航栏标题样式,push 时是生效的,但 pop 时右边界面的样式会覆盖左边界面的样式,所以 pop 时的 titleTextAttributes 改为在 did pop 时处理
406390
// 如果用自定义 titleView 则没这种问题,只是为了代码简单,时机的选择不区分是否自定义 title
407-
BOOL shouldRenderTitle = YES;
408-
if (@available(iOS 13.0, *)) {
409-
} else {
410-
// push/pop 时如果 animated 为 NO,那么走到这里时 push/pop 已经结束了,action 处于 unknown 状态,所以这里要把 unknown 也包含进去
411-
// https://github.com/Tencent/QMUI_iOS/issues/1190
412-
shouldRenderTitle = navigationController.qmui_navigationAction >= QMUINavigationActionUnknow && navigationController.qmui_navigationAction <= QMUINavigationActionPushCompleted;
413-
}
414-
if (shouldRenderTitle) {
415-
[vc renderNavigationBarTitleAppearanceAnimated:animated];
416-
}
391+
[vc renderNavigationBarTitleAppearanceAnimated:animated];
417392
}
418393

419394
// 仅处理导航栏标题

QMUIKit/QMUIComponents/QMUIImagePreviewView/QMUIImagePreviewViewController.m

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,7 @@ - (BOOL)prefersStatusBarHidden {
147147
if (self.qmui_visibleState < QMUIViewControllerDidAppear || self.qmui_visibleState >= QMUIViewControllerDidDisappear) {
148148
// 在 present/dismiss 动画过程中,都使用原界面的状态栏显隐状态
149149
if (self.presentingViewController) {
150-
BOOL statusBarHidden = NO;
151-
if (@available(iOS 13.0, *)) {
152-
statusBarHidden = self.presentingViewController.view.window.windowScene.statusBarManager.statusBarHidden;
153-
} else {
154-
statusBarHidden = UIApplication.sharedApplication.statusBarHidden;
155-
}
150+
BOOL statusBarHidden = self.presentingViewController.view.window.windowScene.statusBarManager.statusBarHidden;
156151
self.originalStatusBarHidden = statusBarHidden;
157152
return self.originalStatusBarHidden;
158153
}

QMUIKit/QMUIComponents/QMUIKeyboardManager.m

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,12 @@ - (void)setNotification:(NSNotification *)notification {
230230
CGRect beginFrame = [[self.originUserInfo objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue];
231231
CGRect endFrame = [[self.originUserInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
232232

233-
if (@available(iOS 13.0, *)) {
234-
// iOS 13 分屏键盘 x 不是 0,不知道是系统 BUG 还是故意这样,先这样保护,再观察一下后面的 beta 版本
235-
if (IS_SPLIT_SCREEN_IPAD && beginFrame.origin.x > 0) {
236-
beginFrame.origin.x = 0;
237-
}
238-
if (IS_SPLIT_SCREEN_IPAD && endFrame.origin.x > 0) {
239-
endFrame.origin.x = 0;
240-
}
233+
// iOS 13 分屏键盘 x 不是 0,不知道是系统 BUG 还是故意这样,先这样保护,再观察一下后面的 beta 版本
234+
if (IS_SPLIT_SCREEN_IPAD && beginFrame.origin.x > 0) {
235+
beginFrame.origin.x = 0;
236+
}
237+
if (IS_SPLIT_SCREEN_IPAD && endFrame.origin.x > 0) {
238+
endFrame.origin.x = 0;
241239
}
242240

243241
_beginFrame = beginFrame;

QMUIKit/QMUIComponents/QMUILogManagerViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ - (void)initTableView {
4949
- (void)initSearchController {
5050
[super initSearchController];
5151
self.searchController.qmui_preferredStatusBarStyleBlock = ^UIStatusBarStyle{
52-
return QMUIStatusBarStyleDarkContent;
52+
return UIStatusBarStyleDarkContent;
5353
};
5454
}
5555

QMUIKit/QMUIComponents/QMUIModalPresentationViewController.m

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -805,23 +805,6 @@ + (BOOL)hideAllVisibleModalPresentationViewControllerIfCan {
805805

806806
@implementation QMUIModalPresentationWindow
807807

808-
- (void)layoutSubviews {
809-
[super layoutSubviews];
810-
// 避免来电状态时只 modal 的遮罩只盖住一部分的状态栏
811-
// 但在 iOS 13 及以后,来电状态下状态栏的高度不会再变化了
812-
// https://github.com/Tencent/QMUI_iOS/issues/375
813-
if (@available(iOS 13.0, *)) {
814-
} else {
815-
if (self.rootViewController) {
816-
UIView *rootView = self.rootViewController.view;
817-
if (CGRectGetMinY(rootView.frame) > 0 && !UIApplication.sharedApplication.statusBarHidden && StatusBarHeight > CGRectGetMinY(rootView.frame)) {
818-
rootView.frame = self.bounds;
819-
}
820-
}
821-
}
822-
823-
}
824-
825808
@end
826809

827810
@implementation UIViewController (QMUIModalPresentationViewController)

QMUIKit/QMUIComponents/QMUISearchController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ - (BOOL)shouldShowSearchBar {
400400

401401
- (void)initSearchController {
402402
if ([self isViewLoaded] && self.shouldShowSearchBar && !self.searchController) {
403-
self.searchController = [[QMUISearchController alloc] initWithContentsViewController:self resultsTableViewStyle:self.tableView.qmui_style];
403+
self.searchController = [[QMUISearchController alloc] initWithContentsViewController:self resultsTableViewStyle:self.tableView.style];
404404
self.searchController.searchResultsDelegate = self;
405405
self.searchController.searchBar.placeholder = @"搜索";
406406
self.searchController.searchBar.qmui_usedAsTableHeaderView = YES;// 以 tableHeaderView 的方式使用 searchBar 的话,将其置为 YES,以辅助兼容一些系统 bug

QMUIKit/QMUIComponents/QMUITableViewHeaderFooterView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ - (UIColor *)backgroundColor {
6060
- (void)updateAppearance {
6161
if (!QMUICMIActivated || (!self.parentTableView && !self.qmui_tableView) || self.type == QMUITableViewHeaderFooterViewTypeUnknow) return;
6262

63-
UITableViewStyle style = (self.parentTableView ?: self.qmui_tableView).qmui_style;
63+
UITableViewStyle style = (self.parentTableView ?: self.qmui_tableView).style;
6464

6565
if (self.type == QMUITableViewHeaderFooterViewTypeHeader) {
6666
self.titleLabel.font = PreferredValueForTableViewStyle(style, TableViewSectionHeaderFont, TableViewGroupedSectionHeaderFont, TableViewInsetGroupedSectionHeaderFont);

QMUIKit/QMUIComponents/QMUITheme/QMUIThemeManager.m

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,22 @@ - (instancetype)initWithName:(__kindof NSObject<NSCopying> *)name {
4343
_name = name;
4444
self._themeIdentifiers = NSMutableArray.new;
4545
self._themes = NSMutableArray.new;
46-
if (@available(iOS 13.0, *)) {
47-
[UITraitCollection qmui_addUserInterfaceStyleWillChangeObserver:self selector:@selector(handleUserInterfaceStyleWillChangeEvent:)];
48-
}
46+
[UITraitCollection qmui_addUserInterfaceStyleWillChangeObserver:self selector:@selector(handleUserInterfaceStyleWillChangeEvent:)];
4947
}
5048
return self;
5149
}
5250

5351
- (void)handleUserInterfaceStyleWillChangeEvent:(UITraitCollection *)traitCollection {
5452
if (!_respondsSystemStyleAutomatically) return;
55-
if (@available(iOS 13.0, *)) {
56-
if (traitCollection && self.identifierForTrait) {
57-
self.currentThemeIdentifier = self.identifierForTrait(traitCollection);
58-
}
53+
if (traitCollection && self.identifierForTrait) {
54+
self.currentThemeIdentifier = self.identifierForTrait(traitCollection);
5955
}
6056
}
6157

6258
- (void)setRespondsSystemStyleAutomatically:(BOOL)respondsSystemStyleAutomatically {
6359
_respondsSystemStyleAutomatically = respondsSystemStyleAutomatically;
64-
if (@available(iOS 13.0, *)) {
65-
if (_respondsSystemStyleAutomatically && self.identifierForTrait) {
66-
self.currentThemeIdentifier = self.identifierForTrait([UITraitCollection currentTraitCollection]);
67-
}
60+
if (_respondsSystemStyleAutomatically && self.identifierForTrait) {
61+
self.currentThemeIdentifier = self.identifierForTrait([UITraitCollection currentTraitCollection]);
6862
}
6963
}
7064

0 commit comments

Comments
 (0)