diff --git a/LEEAlert.podspec b/LEEAlert.podspec index d43a43c..74e476f 100644 --- a/LEEAlert.podspec +++ b/LEEAlert.podspec @@ -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" diff --git a/LEEAlert/LEEAlert.h b/LEEAlert/LEEAlert.h index 47dcc76..95d6185 100644 --- a/LEEAlert/LEEAlert.h +++ b/LEEAlert/LEEAlert.h @@ -13,7 +13,7 @@ * * @author LEE * @copyright Copyright © 2016 - 2019年 lee. All rights reserved. - * @version V1.3.3 + * @version V1.3.4 */ #import diff --git a/LEEAlert/LEEAlert.m b/LEEAlert/LEEAlert.m index cd6f22a..8825fc9 100644 --- a/LEEAlert/LEEAlert.m +++ b/LEEAlert/LEEAlert.m @@ -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" @@ -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())) { @@ -1276,9 +1244,7 @@ - (void)updateCornerRadii{ } -- (void)lee_alert_layoutSubviews{ - - [self lee_alert_layoutSubviews]; +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ [self updateCornerRadii]; } @@ -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); @@ -1836,8 +1812,6 @@ @interface LEEBaseViewController () @property (nonatomic , assign ) LEEScreenOrientationType orientationType; -@property (nonatomic , strong ) LEECustomView *customView; - @property (nonatomic , assign ) BOOL isShowing; @property (nonatomic , assign ) BOOL isClosing; @@ -1859,8 +1833,6 @@ - (void)dealloc{ _currentKeyWindow = nil; _backgroundVisualEffectView = nil; - - _customView = nil; } - (void)viewDidLoad{ diff --git a/LEEAlert/LEEAlertHelper.h b/LEEAlert/LEEAlertHelper.h index f4c63ae..a327c7c 100644 --- a/LEEAlert/LEEAlertHelper.h +++ b/LEEAlert/LEEAlertHelper.h @@ -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 diff --git a/UPDATELOG.md b/UPDATELOG.md index d05bc83..45b702b 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -1,6 +1,10 @@ # LEEAlert - 更新日志 +V1.3.4 +============== +优化圆角内部处理 + V1.3.3 ============== 增加iOS13 windowScene支持, 在 AppDelegate 或 SceneDelegate 中设置主要Window