Skip to content

Commit

Permalink
4.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
molicechen committed Dec 14, 2022
1 parent ebb361f commit f396f60
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 16 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 = "4.6.1"
s.version = "4.6.2"
s.summary = "致力于提高项目 UI 开发效率的解决方案"
s.description = <<-DESC
QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。
Expand Down
11 changes: 8 additions & 3 deletions QMUIKit/QMUIComponents/QMUITextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ - (BOOL)textField:(QMUITextField *)textField shouldChangeCharactersInRange:(NSRa

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

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

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

Expand All @@ -222,7 +228,7 @@ - (BOOL)textField:(QMUITextField *)textField shouldChangeCharactersInRange:(NSRa
if ([textField lengthWithString:allowedText] <= substringLength) {
BOOL shouldChange = YES;
if ([textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:originalValue:)]) {
shouldChange = [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:allowedText originalValue:shouldChange];
shouldChange = [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:allowedText originalValue:YES];
}
if (!shouldChange) {
return NO;
Expand All @@ -249,8 +255,7 @@ - (BOOL)textField:(QMUITextField *)textField shouldChangeCharactersInRange:(NSRa
}

if ([textField.delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:originalValue:)]) {
BOOL delegateValue = [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:string originalValue:YES];
return delegateValue;
return [textField.delegate textField:textField shouldChangeCharactersInRange:range replacementString:string originalValue:YES];
}

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

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

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

Expand All @@ -447,7 +453,7 @@ - (BOOL)textView:(QMUITextView *)textView shouldChangeTextInRange:(NSRange)range
if ([textView lengthWithString:allowedText] <= substringLength) {
BOOL shouldChange = YES;
if ([textView.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:originalValue:)]) {
shouldChange = [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:shouldChange];
shouldChange = [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
}
if (!shouldChange) {
return NO;
Expand All @@ -471,8 +477,7 @@ - (BOOL)textView:(QMUITextView *)textView shouldChangeTextInRange:(NSRange)range
}

if ([textView.delegate respondsToSelector:@selector(textView:shouldChangeTextInRange:replacementText:originalValue:)]) {
BOOL delegateValue = [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
return delegateValue;
return [textView.delegate textView:textView shouldChangeTextInRange:range replacementText:text originalValue:YES];
}

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

[(__bridge id)(cgColor) qmui_bindObject:self forKey:QMUICGColorOriginalColorBindKey];
return cgColor;
return (CGColorRef)CFAutorelease(cgColor);
}

- (NSString *)colorSpaceName {
Expand Down
2 changes: 1 addition & 1 deletion QMUIKit/QMUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#ifndef QMUIKit_h
#define QMUIKit_h

static NSString * const QMUI_VERSION = @"4.6.1";
static NSString * const QMUI_VERSION = @"4.6.2";

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

[(__bridge id)(result) qmui_bindObject:selfObject forKey:QMUICGColorOriginalColorBindKey];
}
return result;
return (CGColorRef)CFAutorelease(result);
};
});
});
Expand Down
2 changes: 1 addition & 1 deletion QMUIKit/UIKitExtensions/UIInterface+QMUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
尝试将手机旋转为指定方向。请确保传进来的参数属于 -[UIViewController supportedInterfaceOrientations] 返回的范围内,如不在该范围内会旋转失败。
@return 旋转成功则返回 YES,旋转失败返回 NO。
@note 请注意与 @c qmui_setNeedsUpdateOfSupportedInterfaceOrientations 的区别:如果你的界面支持N个方向,而你希望保持对这N个方向的支持的情况下把设备方向旋转为这N个方向里的某一个时,应该调用 @c qmui_rotateToInterfaceOrientation: 。如果你的界面支持N个方向,而某些情况下你希望把N换成M并触发设备的方向刷新,则请修改方向后,调用 @c qmui_setNeedsUpdateOfSupportedInterfaceOrientations 。
@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
*/
- (BOOL)qmui_rotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;

Expand Down
3 changes: 3 additions & 0 deletions QMUIKit/UIKitExtensions/UIInterface+QMUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ + (void)load {
- (BOOL)qmui_rotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
#ifdef IOS16_SDK_ALLOWED
if (@available(iOS 16.0, *)) {

[self setNeedsUpdateOfSupportedInterfaceOrientations];

__block BOOL result = YES;
UIInterfaceOrientationMask mask = 1 << interfaceOrientation;
UIWindow *window = self.view.window ?: UIApplication.sharedApplication.delegate.window;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设
## 支持iOS版本

1. 4.6.1 及以上,iOS 13+。
2. 4.0 及以上,iOS 11+。
2. 4.4.0 及以上,iOS 11+。
3. 4.2.0 及以上,iOS 10+。
4. 3.0.0 及以上,iOS 9+。
5. 2.0.0 及以上,iOS 8+。
Expand Down
4 changes: 2 additions & 2 deletions qmui.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1973,7 +1973,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = mh_dylib;
MARKETING_VERSION = 4.6.1;
MARKETING_VERSION = 4.6.2;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.qmui.QMUIKit;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -2017,7 +2017,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = mh_dylib;
MARKETING_VERSION = 4.6.1;
MARKETING_VERSION = 4.6.2;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.qmui.QMUIKit;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down

0 comments on commit f396f60

Please sign in to comment.