Skip to content

Commit a2a59a8

Browse files
committed
2.8.1
1 parent 3f16854 commit a2a59a8

9 files changed

Lines changed: 34 additions & 20 deletions

File tree

QMUIKit.podspec

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

QMUIKit/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.8.0</string>
18+
<string>2.8.1</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

QMUIKit/QMUIComponents/ImagePickerLibrary/QMUIImagePickerPreviewViewController.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ - (void)initSubviews {
7777
[self.view addSubview:self.topToolBarView];
7878

7979
_backButton = [[QMUINavigationButton alloc] initWithType:QMUINavigationButtonTypeBack];
80-
[self.backButton sizeToFit];
8180
[self.backButton addTarget:self action:@selector(handleCancelPreviewImage:) forControlEvents:UIControlEventTouchUpInside];
8281
self.backButton.qmui_outsideEdge = UIEdgeInsetsMake(-30, -20, -50, -80);
8382
[self.topToolBarView addSubview:self.backButton];
@@ -117,9 +116,9 @@ - (void)viewDidLayoutSubviews {
117116
self.topToolBarView.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), NavigationContentTopConstant);
118117
CGFloat topToolbarPaddingTop = SafeAreaInsetsConstantForDeviceWithNotch.top;
119118
CGFloat topToolbarContentHeight = CGRectGetHeight(self.topToolBarView.bounds) - topToolbarPaddingTop;
120-
self.backButton.frame = CGRectSetXY(self.backButton.frame, 16, topToolbarPaddingTop + CGFloatGetCenter(topToolbarContentHeight, CGRectGetHeight(self.backButton.frame)));
119+
self.backButton.frame = CGRectSetXY(self.backButton.frame, 16 + self.view.qmui_safeAreaInsets.left, topToolbarPaddingTop + CGFloatGetCenter(topToolbarContentHeight, CGRectGetHeight(self.backButton.frame)));
121120
if (!self.checkboxButton.hidden) {
122-
self.checkboxButton.frame = CGRectSetXY(self.checkboxButton.frame, CGRectGetWidth(self.topToolBarView.frame) - 10 - CGRectGetWidth(self.checkboxButton.frame), topToolbarPaddingTop + CGFloatGetCenter(topToolbarContentHeight, CGRectGetHeight(self.checkboxButton.frame)));
121+
self.checkboxButton.frame = CGRectSetXY(self.checkboxButton.frame, CGRectGetWidth(self.topToolBarView.frame) - 10 - self.view.qmui_safeAreaInsets.right - CGRectGetWidth(self.checkboxButton.frame), topToolbarPaddingTop + CGFloatGetCenter(topToolbarContentHeight, CGRectGetHeight(self.checkboxButton.frame)));
123122
}
124123
}
125124

QMUIKit/QMUIComponents/QMUIButton/QMUINavigationButton.m

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ - (void)renderButtonStyle {
7373
self.adjustsImageWhenHighlighted = NO;
7474
self.adjustsImageWhenDisabled = NO;
7575

76-
if (@available(iOS 11, *)) {
77-
self.translatesAutoresizingMaskIntoConstraints = NO;// 打开这个才能让 iOS 11 下的 alignmentRectInsets 生效
78-
}
79-
8076
switch (self.type) {
8177
case QMUINavigationButtonTypeNormal:
8278
break;
@@ -173,13 +169,8 @@ - (UIEdgeInsets)alignmentRectInsets {
173169

174170
// 对于奇数大小的字号,不同 iOS 版本的偏移策略不同,统一一下
175171
if (self.titleLabel.font.pointSize / 2.0 > 0) {
176-
if (@available(iOS 11, *)) {
177-
insets.top = PixelOne;
178-
insets.bottom = -PixelOne;
179-
} else {
180-
insets.top = -PixelOne;
181-
insets.bottom = PixelOne;
182-
}
172+
insets.top = -PixelOne;
173+
insets.bottom = PixelOne;
183174
}
184175
} else if (self.type == QMUINavigationButtonTypeImage) {
185176
// 图片类型的按钮,分别对最左、最右那个按钮调整 inset(这里与 UINavigationItem(QMUINavigationButton) 里的 position 赋值配合使用)

QMUIKit/QMUICore/QMUICommonDefines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
#define StatusBarHeight ([UIApplication sharedApplication].statusBarHidden ? 0 : [[UIApplication sharedApplication] statusBarFrame].size.height)
150150

151151
// 状态栏高度(如果状态栏不可见,也会返回一个普通状态下可见的高度)
152-
#define StatusBarHeightConstant ([UIApplication sharedApplication].statusBarHidden ? PreferredValueForNotchedDevice(44, 20) : [[UIApplication sharedApplication] statusBarFrame].size.height)
152+
#define StatusBarHeightConstant ([UIApplication sharedApplication].statusBarHidden ? PreferredValueForNotchedDevice(IS_LANDSCAPE ? 0 : 44, 20) : [[UIApplication sharedApplication] statusBarFrame].size.height)
153153

154154
// navigationBar 的静态高度
155155
#define NavigationBarHeight (IS_LANDSCAPE ? PreferredValueForVisualDevice(44, 32) : 44)

QMUIKit/QMUICore/QMUIConfiguration.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import "UIImage+QMUI.h"
1212
#import "NSString+QMUI.h"
1313
#import "UIViewController+QMUI.h"
14+
#import "QMUIKit.h"
1415
#import <objc/runtime.h>
1516

1617
// 在 iOS 8 - 11 上实际测量得到
@@ -80,7 +81,10 @@ - (void)applyInitialTemplate {
8081
}
8182

8283
- (void)sendAnalytics {
83-
NSString *appInfo = [NSString stringWithFormat:@"appId=%@&appName=%@&version=%@&platform=iOS", [NSBundle mainBundle].bundleIdentifier.qmui_stringByEncodingUserInputQuery, ((NSString *)[NSBundle mainBundle].infoDictionary[@"CFBundleDisplayName"]).qmui_stringByEncodingUserInputQuery, ((NSString *)[NSBundle bundleForClass:[self class]].infoDictionary[@"CFBundleShortVersionString"]).qmui_stringByEncodingUserInputQuery];
84+
NSString *identifier = [NSBundle mainBundle].bundleIdentifier.qmui_stringByEncodingUserInputQuery;
85+
NSString *displayName = ((NSString *)([NSBundle mainBundle].infoDictionary[@"CFBundleDisplayName"] ?: [NSBundle mainBundle].infoDictionary[@"CFBundleName"])).qmui_stringByEncodingUserInputQuery;
86+
NSString *QMUIVersion = QMUI_VERSION.qmui_stringByEncodingUserInputQuery;// 如果不以 framework 方式引入 QMUI 的话,是无法通过 CFBundleShortVersionString 获取到 QMUI 所在的 bundle 的版本号的,所以这里改为用脚本生成的变量来获取
87+
NSString *appInfo = [NSString stringWithFormat:@"appId=%@&appName=%@&version=%@&platform=iOS", identifier, displayName, QMUIVersion];
8488
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://qmuiteam.com/analytics/usageReport"]];
8589
request.HTTPMethod = @"POST";
8690
request.HTTPBody = [appInfo dataUsingEncoding:NSUTF8StringEncoding];

QMUIKit/QMUIKit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef QMUIKit_h
66
#define QMUIKit_h
77

8+
static NSString * const QMUI_VERSION = @"2.8.1";
9+
810
#if __has_include("CAAnimation+QMUI.h")
911
#import "CAAnimation+QMUI.h"
1012
#endif

qmui.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@
11601160
);
11611161
runOnlyForDeploymentPostprocessing = 0;
11621162
shellPath = "/usr/bin/python ./umbrellaHeaderFileCreator.py";
1163-
shellScript = "";
1163+
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n";
11641164
};
11651165
/* End PBXShellScriptBuildPhase section */
11661166

umbrellaHeaderFileCreator.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,23 @@
22
#coding:utf-8
33

44
import os
5+
try:
6+
import xml.etree.cElementTree as ET
7+
except ImportError:
8+
import xml.etree.ElementTree as ET
59

10+
# 从 Info.plist 中读取 QMUIKit 的版本号,将其定义为一个 static const 常量以便代码里获取
11+
infoFilePath = str(os.getenv('SRCROOT')) + '/QMUIKit/Info.plist'
12+
infoTree = ET.parse(infoFilePath)
13+
infoDictList = list(infoTree.find('dict'))
14+
versionString = '0.0.0'
15+
for index in range(len(infoDictList)):
16+
element = infoDictList[index]
17+
if element.text == 'CFBundleShortVersionString':
18+
versionString = infoDictList[index + 1].text
19+
break
20+
21+
# 读取头文件准备生成 umbrella file
622
publicHeaderFilePath = str(os.getenv('BUILT_PRODUCTS_DIR')) + '/' + os.getenv('PUBLIC_HEADERS_FOLDER_PATH')
723
print 'umbrella creator: publicHeaderFilePath = ' + publicHeaderFilePath
824
umbrellaHeaderFileName = 'QMUIKit.h'
@@ -15,7 +31,9 @@
1531
#ifndef QMUIKit_h
1632
#define QMUIKit_h
1733
18-
'''
34+
static NSString * const QMUI_VERSION = @"%s";
35+
36+
''' % (versionString)
1937

2038
onlyfiles = [ f for f in os.listdir(publicHeaderFilePath) if os.path.isfile(os.path.join(publicHeaderFilePath, f))]
2139
onlyfiles.sort()

0 commit comments

Comments
 (0)