Skip to content

Commit

Permalink
发布 1.3.4 优化圆角内部处理
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiang1994 committed Feb 28, 2020
1 parent 35f9c6e commit 5d2dd76
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 43 deletions.
2 changes: 1 addition & 1 deletion LEEAlert.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "LEEAlert"
s.version = "1.3.3"
s.version = "1.3.4"
s.summary = "优雅的Alert ActionSheet"

s.homepage = "https://github.com/lixiang1994/LEEAlert"
Expand Down
2 changes: 1 addition & 1 deletion LEEAlert/LEEAlert.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author LEE
* @copyright Copyright © 2016 - 2019年 lee. All rights reserved.
* @version V1.3.3
* @version V1.3.4
*/

#import <Foundation/Foundation.h>
Expand Down
52 changes: 12 additions & 40 deletions LEEAlert/LEEAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author LEE
* @copyright Copyright © 2016 - 2019年 lee. All rights reserved.
* @version V1.3.3
* @version V1.3.4
*/

#import "LEEAlert.h"
Expand Down Expand Up @@ -1210,38 +1210,6 @@ CGPathRef _Nullable LEECGPathCreateWithRoundedRect(CGRect bounds, CornerRadii co
return path;
}

+ (void)load{

static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{

NSArray *selStringsArray = @[@"layoutSubviews"];

[selStringsArray enumerateObjectsUsingBlock:^(NSString *selString, NSUInteger idx, BOOL *stop) {

NSString *leeSelString = [@"lee_alert_" stringByAppendingString:selString];

Method originalMethod = class_getInstanceMethod(self, NSSelectorFromString(selString));

Method leeMethod = class_getInstanceMethod(self, NSSelectorFromString(leeSelString));

BOOL isAddedMethod = class_addMethod(self, NSSelectorFromString(selString), method_getImplementation(leeMethod), method_getTypeEncoding(leeMethod));

if (isAddedMethod) {

class_replaceMethod(self, NSSelectorFromString(leeSelString), method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));

} else {

method_exchangeImplementations(originalMethod, leeMethod);
}

}];

});

}

- (void)updateCornerRadii{

if (!CornerRadiiEqualTo([self lee_alert_cornerRadii], CornerRadiiNull())) {
Expand Down Expand Up @@ -1276,9 +1244,7 @@ - (void)updateCornerRadii{

}

- (void)lee_alert_layoutSubviews{

[self lee_alert_layoutSubviews];
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context{

[self updateCornerRadii];
}
Expand All @@ -1303,6 +1269,16 @@ - (CornerRadii)lee_alert_cornerRadii{

- (void)setLee_alert_cornerRadii:(CornerRadii)cornerRadii{

if (CornerRadiiEqualTo(self.lee_alert_cornerRadii, CornerRadiiNull()) && !CornerRadiiEqualTo(cornerRadii, CornerRadiiNull())) {
[self addObserver: self forKeyPath: @"frame" options: NSKeyValueObservingOptionNew context: nil];
[self addObserver: self forKeyPath: @"bounds" options: NSKeyValueObservingOptionNew context: nil];
}

if (!CornerRadiiEqualTo(self.lee_alert_cornerRadii, CornerRadiiNull()) && CornerRadiiEqualTo(cornerRadii, CornerRadiiNull())) {
[self removeObserver:self forKeyPath:@"frame"];
[self removeObserver:self forKeyPath:@"bounds"];
}

NSValue *value = [NSValue valueWithBytes:&cornerRadii objCType:@encode(CornerRadii)];

objc_setAssociatedObject(self, @selector(lee_alert_cornerRadii), value , OBJC_ASSOCIATION_RETAIN_NONATOMIC);
Expand Down Expand Up @@ -1836,8 +1812,6 @@ @interface LEEBaseViewController ()<UIGestureRecognizerDelegate>

@property (nonatomic , assign ) LEEScreenOrientationType orientationType;

@property (nonatomic , strong ) LEECustomView *customView;

@property (nonatomic , assign ) BOOL isShowing;

@property (nonatomic , assign ) BOOL isClosing;
Expand All @@ -1859,8 +1833,6 @@ - (void)dealloc{
_currentKeyWindow = nil;

_backgroundVisualEffectView = nil;

_customView = nil;
}

- (void)viewDidLoad{
Expand Down
2 changes: 1 addition & 1 deletion LEEAlert/LEEAlertHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*
* @author LEE
* @copyright Copyright © 2016 - 2019年 lee. All rights reserved.
* @version V1.3.3
* @version V1.3.4
*/

#ifndef LEEAlertHelper_h
Expand Down
4 changes: 4 additions & 0 deletions UPDATELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# LEEAlert - 更新日志

V1.3.4
==============
优化圆角内部处理

V1.3.3
==============
增加iOS13 windowScene支持, 在 AppDelegate 或 SceneDelegate 中设置主要Window
Expand Down

0 comments on commit 5d2dd76

Please sign in to comment.