Skip to content

Commit f396f60

Browse files
author
molicechen
committed
4.6.2
1 parent ebb361f commit f396f60

File tree

10 files changed

+34
-16
lines changed

10 files changed

+34
-16
lines changed

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

QMUIKit/QMUIComponents/QMUITextField.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ - (BOOL)textField:(QMUITextField *)textField shouldChangeCharactersInRange:(NSRa
192192

193193
// 如果是中文输入法正在输入拼音的过程中(markedTextRange 不为 nil),是不应该限制字数的(例如输入“huang”这5个字符,其实只是为了输入“黄”这一个字符),所以在 shouldChange 这里不会限制,而是放在 didChange 那里限制。
194194
if (textField.markedTextRange) {
195+
if ([textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:originalValue:)]) {
196+
return [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:string originalValue:YES];
197+
}
195198
return YES;
196199
}
197200

@@ -210,6 +213,9 @@ - (BOOL)textField:(QMUITextField *)textField shouldChangeCharactersInRange:(NSRa
210213

211214
if (!string.length && range.length > 0) {
212215
// 允许删除,这段必须放在上面 #377、#1170 的逻辑后面
216+
if ([textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:originalValue:)]) {
217+
return [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:string originalValue:YES];
218+
}
213219
return YES;
214220
}
215221

@@ -222,7 +228,7 @@ - (BOOL)textField:(QMUITextField *)textField shouldChangeCharactersInRange:(NSRa
222228
if ([textField lengthWithString:allowedText] <= substringLength) {
223229
BOOL shouldChange = YES;
224230
if ([textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:originalValue:)]) {
225-
shouldChange = [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:allowedText originalValue:shouldChange];
231+
shouldChange = [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:allowedText originalValue:YES];
226232
}
227233
if (!shouldChange) {
228234
return NO;
@@ -249,8 +255,7 @@ - (BOOL)textField:(QMUITextField *)textField shouldChangeCharactersInRange:(NSRa
249255
}
250256

251257
if ([textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:originalValue:)]) {
252-
BOOL delegateValue = [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:string originalValue:YES];
253-
return delegateValue;
258+
return [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:string originalValue:YES];
254259
}
255260

256261
return YES;

QMUIKit/QMUIComponents/QMUITextView.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,9 @@ - (BOOL)textView:(QMUITextView *)textView shouldChangeTextInRange:(NSRange)range
411411
// 如果是中文输入法正在输入拼音的过程中(markedTextRange 不为 nil),是不应该限制字数的(例如输入“huang”这5个字符,其实只是为了输入“黄”这一个字符)
412412
// 注意当点击了候选词后触发的那一次 textView:shouldChangeTextInRange:replacementText:,此时的 marktedTextRange 依然存在,尚未被清除,所以这种情况下的字符长度限制逻辑会交给 handleTextChanged: 那边处理。
413413
if (textView.markedTextRange) {
414+
if ([textView.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:originalValue:)]) {
415+
return [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
416+
}
414417
return YES;
415418
}
416419

@@ -429,6 +432,9 @@ - (BOOL)textView:(QMUITextView *)textView shouldChangeTextInRange:(NSRange)range
429432

430433
if (!text.length && range.length > 0) {
431434
// 允许删除,这段必须放在上面 #377、#1170 的逻辑后面
435+
if ([textView.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:originalValue:)]) {
436+
return [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
437+
}
432438
return YES;
433439
}
434440

@@ -447,7 +453,7 @@ - (BOOL)textView:(QMUITextView *)textView shouldChangeTextInRange:(NSRange)range
447453
if ([textView lengthWithString:allowedText] <= substringLength) {
448454
BOOL shouldChange = YES;
449455
if ([textView.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:originalValue:)]) {
450-
shouldChange = [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:shouldChange];
456+
shouldChange = [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
451457
}
452458
if (!shouldChange) {
453459
return NO;
@@ -471,8 +477,7 @@ - (BOOL)textView:(QMUITextView *)textView shouldChangeTextInRange:(NSRange)range
471477
}
472478

473479
if ([textView.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:originalValue:)]) {
474-
BOOL delegateValue = [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
475-
return delegateValue;
480+
return [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
476481
}
477482

478483
return YES;

QMUIKit/QMUIComponents/QMUITheme/UIColor+QMUITheme.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ - (CGColorRef)CGColor {
100100
// CGColor 必须通过 CGColorCreate 创建。UIColor.CGColor 返回的是一个多对象复用的 CGColor 值(例如,如果 QMUIThemeA.light 值和 UIColorB 的值刚好相同,那么他们的 CGColor 可能也是同一个对象,所以 UIColorB.CGColor 可能会错误地使用了原本仅属于 QMUIThemeColorA 的 bindObject)
101101
// 经测试,qmui_red 系列接口适用于不同的 ColorSpace,应该是能放心使用的😜
102102
// https://github.com/Tencent/QMUI_iOS/issues/1463
103-
CGColorRef cgColor = CGColorCreate(CGColorSpaceCreateDeviceRGB(), (CGFloat[]){rawColor.qmui_red, rawColor.qmui_green, rawColor.qmui_blue, rawColor.qmui_alpha});
103+
CGColorSpaceRef spaceRef = CGColorSpaceCreateDeviceRGB();
104+
CGColorRef cgColor = CGColorCreate(spaceRef, (CGFloat[]){rawColor.qmui_red, rawColor.qmui_green, rawColor.qmui_blue, rawColor.qmui_alpha});
105+
CGColorSpaceRelease(spaceRef);
106+
CFRelease(spaceRef);
104107

105108
[(__bridge id)(cgColor) qmui_bindObject:self forKey:QMUICGColorOriginalColorBindKey];
106-
return cgColor;
109+
return (CGColorRef)CFAutorelease(cgColor);
107110
}
108111

109112
- (NSString *)colorSpaceName {

QMUIKit/QMUIKit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef QMUIKit_h
1414
#define QMUIKit_h
1515

16-
static NSString * const QMUI_VERSION = @"4.6.1";
16+
static NSString * const QMUI_VERSION = @"4.6.2";
1717

1818
#if __has_include("CAAnimation+QMUI.h")
1919
#import "CAAnimation+QMUI.h"

QMUIKit/UIKitExtensions/UIColor+QMUI.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,13 @@ + (void)load {
337337
// CGColor 必须通过 CGColorCreate 创建。UIColor.CGColor 返回的是一个多对象复用的 CGColor 值(例如,如果 QMUIThemeA.light 值和 UIColorB 的值刚好相同,那么他们的 CGColor 可能也是同一个对象,所以 UIColorB.CGColor 可能会错误地使用了原本仅属于 QMUIThemeColorA 的 bindObject)
338338
// 经测试,qmui_red 系列接口适用于不同的 ColorSpace,应该是能放心使用的😜
339339
// https://github.com/Tencent/QMUI_iOS/issues/1463
340-
result = CGColorCreate(CGColorSpaceCreateDeviceRGB(), (CGFloat[]){color.qmui_red, color.qmui_green, color.qmui_blue, color.qmui_alpha});
340+
CGColorSpaceRef spaceRef = CGColorSpaceCreateDeviceRGB();
341+
result = CGColorCreate(spaceRef, (CGFloat[]){color.qmui_red, color.qmui_green, color.qmui_blue, color.qmui_alpha});
342+
CGColorSpaceRelease(spaceRef);
341343

342344
[(__bridge id)(result) qmui_bindObject:selfObject forKey:QMUICGColorOriginalColorBindKey];
343345
}
344-
return result;
346+
return (CGColorRef)CFAutorelease(result);
345347
};
346348
});
347349
});

QMUIKit/UIKitExtensions/UIInterface+QMUI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
5353
/**
5454
尝试将手机旋转为指定方向。请确保传进来的参数属于 -[UIViewController supportedInterfaceOrientations] 返回的范围内,如不在该范围内会旋转失败。
5555
@return 旋转成功则返回 YES,旋转失败返回 NO。
56-
@note 请注意与 @c qmui_setNeedsUpdateOfSupportedInterfaceOrientations 的区别:如果你的界面支持N个方向,而你希望保持对这N个方向的支持的情况下把设备方向旋转为这N个方向里的某一个时,应该调用 @c qmui_rotateToInterfaceOrientation: 。如果你的界面支持N个方向,而某些情况下你希望把N换成M并触发设备的方向刷新,则请修改方向后,调用 @c qmui_setNeedsUpdateOfSupportedInterfaceOrientations 。
56+
@note 请注意与 @c qmui_setNeedsUpdateOfSupportedInterfaceOrientations 的区别:如果你的界面支持N个方向,而你希望保持对这N个方向的支持的情况下把设备方向旋转为这N个方向里的某一个时,应该调用 @c qmui_rotateToInterfaceOrientation: 。如果你的界面支持N个方向,而某些情况下你希望把N换成M并触发设备的方向刷新,则请修改方向后,调用 @c qmui_setNeedsUpdateOfSupportedInterfaceOrientations 。更详细可查看:https://github.com/Tencent/QMUI_iOS/wiki/%E9%80%82%E7%94%A8%E4%BA%8E-iOS-16-%E5%8F%8A%E4%BB%A5%E4%B8%8B%E7%89%88%E6%9C%AC%E7%9A%84%E5%B1%8F%E5%B9%95%E6%96%B9%E5%90%91%E6%8E%A7%E5%88%B6%E6%96%B9%E5%BC%8F
5757
*/
5858
- (BOOL)qmui_rotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
5959

QMUIKit/UIKitExtensions/UIInterface+QMUI.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ + (void)load {
180180
- (BOOL)qmui_rotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
181181
#ifdef IOS16_SDK_ALLOWED
182182
if (@available(iOS 16.0, *)) {
183+
184+
[self setNeedsUpdateOfSupportedInterfaceOrientations];
185+
183186
__block BOOL result = YES;
184187
UIInterfaceOrientationMask mask = 1 << interfaceOrientation;
185188
UIWindow *window = self.view.window ?: UIApplication.sharedApplication.delegate.window;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设
3030
## 支持iOS版本
3131

3232
1. 4.6.1 及以上,iOS 13+。
33-
2. 4.0 及以上,iOS 11+。
33+
2. 4.4.0 及以上,iOS 11+。
3434
3. 4.2.0 及以上,iOS 10+。
3535
4. 3.0.0 及以上,iOS 9+。
3636
5. 2.0.0 及以上,iOS 8+。

qmui.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@
19731973
"@loader_path/Frameworks",
19741974
);
19751975
MACH_O_TYPE = mh_dylib;
1976-
MARKETING_VERSION = 4.6.1;
1976+
MARKETING_VERSION = 4.6.2;
19771977
MTL_ENABLE_DEBUG_INFO = YES;
19781978
PRODUCT_BUNDLE_IDENTIFIER = com.qmui.QMUIKit;
19791979
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2017,7 +2017,7 @@
20172017
"@loader_path/Frameworks",
20182018
);
20192019
MACH_O_TYPE = mh_dylib;
2020-
MARKETING_VERSION = 4.6.1;
2020+
MARKETING_VERSION = 4.6.2;
20212021
MTL_ENABLE_DEBUG_INFO = NO;
20222022
PRODUCT_BUNDLE_IDENTIFIER = com.qmui.QMUIKit;
20232023
PRODUCT_NAME = "$(TARGET_NAME)";

0 commit comments

Comments
 (0)