Skip to content

Commit

Permalink
2.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLice committed Sep 26, 2018
1 parent 3f16854 commit a2a59a8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion QMUIKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "QMUIKit"
s.version = "2.8.0"
s.version = "2.8.1"
s.summary = "致力于提高项目 UI 开发效率的解决方案"
s.description = <<-DESC
QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。
Expand Down
2 changes: 1 addition & 1 deletion QMUIKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.8.0</string>
<string>2.8.1</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ - (void)initSubviews {
[self.view addSubview:self.topToolBarView];

_backButton = [[QMUINavigationButton alloc] initWithType:QMUINavigationButtonTypeBack];
[self.backButton sizeToFit];
[self.backButton addTarget:self action:@selector(handleCancelPreviewImage:) forControlEvents:UIControlEventTouchUpInside];
self.backButton.qmui_outsideEdge = UIEdgeInsetsMake(-30, -20, -50, -80);
[self.topToolBarView addSubview:self.backButton];
Expand Down Expand Up @@ -117,9 +116,9 @@ - (void)viewDidLayoutSubviews {
self.topToolBarView.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), NavigationContentTopConstant);
CGFloat topToolbarPaddingTop = SafeAreaInsetsConstantForDeviceWithNotch.top;
CGFloat topToolbarContentHeight = CGRectGetHeight(self.topToolBarView.bounds) - topToolbarPaddingTop;
self.backButton.frame = CGRectSetXY(self.backButton.frame, 16, topToolbarPaddingTop + CGFloatGetCenter(topToolbarContentHeight, CGRectGetHeight(self.backButton.frame)));
self.backButton.frame = CGRectSetXY(self.backButton.frame, 16 + self.view.qmui_safeAreaInsets.left, topToolbarPaddingTop + CGFloatGetCenter(topToolbarContentHeight, CGRectGetHeight(self.backButton.frame)));
if (!self.checkboxButton.hidden) {
self.checkboxButton.frame = CGRectSetXY(self.checkboxButton.frame, CGRectGetWidth(self.topToolBarView.frame) - 10 - CGRectGetWidth(self.checkboxButton.frame), topToolbarPaddingTop + CGFloatGetCenter(topToolbarContentHeight, CGRectGetHeight(self.checkboxButton.frame)));
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)));
}
}

Expand Down
13 changes: 2 additions & 11 deletions QMUIKit/QMUIComponents/QMUIButton/QMUINavigationButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ - (void)renderButtonStyle {
self.adjustsImageWhenHighlighted = NO;
self.adjustsImageWhenDisabled = NO;

if (@available(iOS 11, *)) {
self.translatesAutoresizingMaskIntoConstraints = NO;// 打开这个才能让 iOS 11 下的 alignmentRectInsets 生效
}

switch (self.type) {
case QMUINavigationButtonTypeNormal:
break;
Expand Down Expand Up @@ -173,13 +169,8 @@ - (UIEdgeInsets)alignmentRectInsets {

// 对于奇数大小的字号,不同 iOS 版本的偏移策略不同,统一一下
if (self.titleLabel.font.pointSize / 2.0 > 0) {
if (@available(iOS 11, *)) {
insets.top = PixelOne;
insets.bottom = -PixelOne;
} else {
insets.top = -PixelOne;
insets.bottom = PixelOne;
}
insets.top = -PixelOne;
insets.bottom = PixelOne;
}
} else if (self.type == QMUINavigationButtonTypeImage) {
// 图片类型的按钮,分别对最左、最右那个按钮调整 inset(这里与 UINavigationItem(QMUINavigationButton) 里的 position 赋值配合使用)
Expand Down
2 changes: 1 addition & 1 deletion QMUIKit/QMUICore/QMUICommonDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
#define StatusBarHeight ([UIApplication sharedApplication].statusBarHidden ? 0 : [[UIApplication sharedApplication] statusBarFrame].size.height)

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

// navigationBar 的静态高度
#define NavigationBarHeight (IS_LANDSCAPE ? PreferredValueForVisualDevice(44, 32) : 44)
Expand Down
6 changes: 5 additions & 1 deletion QMUIKit/QMUICore/QMUIConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "UIImage+QMUI.h"
#import "NSString+QMUI.h"
#import "UIViewController+QMUI.h"
#import "QMUIKit.h"
#import <objc/runtime.h>

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

- (void)sendAnalytics {
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];
NSString *identifier = [NSBundle mainBundle].bundleIdentifier.qmui_stringByEncodingUserInputQuery;
NSString *displayName = ((NSString *)([NSBundle mainBundle].infoDictionary[@"CFBundleDisplayName"] ?: [NSBundle mainBundle].infoDictionary[@"CFBundleName"])).qmui_stringByEncodingUserInputQuery;
NSString *QMUIVersion = QMUI_VERSION.qmui_stringByEncodingUserInputQuery;// 如果不以 framework 方式引入 QMUI 的话,是无法通过 CFBundleShortVersionString 获取到 QMUI 所在的 bundle 的版本号的,所以这里改为用脚本生成的变量来获取
NSString *appInfo = [NSString stringWithFormat:@"appId=%@&appName=%@&version=%@&platform=iOS", identifier, displayName, QMUIVersion];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://qmuiteam.com/analytics/usageReport"]];
request.HTTPMethod = @"POST";
request.HTTPBody = [appInfo dataUsingEncoding:NSUTF8StringEncoding];
Expand Down
2 changes: 2 additions & 0 deletions QMUIKit/QMUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef QMUIKit_h
#define QMUIKit_h

static NSString * const QMUI_VERSION = @"2.8.1";

#if __has_include("CAAnimation+QMUI.h")
#import "CAAnimation+QMUI.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion qmui.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/usr/bin/python ./umbrellaHeaderFileCreator.py";
shellScript = "";
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
20 changes: 19 additions & 1 deletion umbrellaHeaderFileCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,23 @@
#coding:utf-8

import os
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET

# 从 Info.plist 中读取 QMUIKit 的版本号,将其定义为一个 static const 常量以便代码里获取
infoFilePath = str(os.getenv('SRCROOT')) + '/QMUIKit/Info.plist'
infoTree = ET.parse(infoFilePath)
infoDictList = list(infoTree.find('dict'))
versionString = '0.0.0'
for index in range(len(infoDictList)):
element = infoDictList[index]
if element.text == 'CFBundleShortVersionString':
versionString = infoDictList[index + 1].text
break

# 读取头文件准备生成 umbrella file
publicHeaderFilePath = str(os.getenv('BUILT_PRODUCTS_DIR')) + '/' + os.getenv('PUBLIC_HEADERS_FOLDER_PATH')
print 'umbrella creator: publicHeaderFilePath = ' + publicHeaderFilePath
umbrellaHeaderFileName = 'QMUIKit.h'
Expand All @@ -15,7 +31,9 @@
#ifndef QMUIKit_h
#define QMUIKit_h
'''
static NSString * const QMUI_VERSION = @"%s";
''' % (versionString)

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

0 comments on commit a2a59a8

Please sign in to comment.