Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Commit 75647ba

Browse files
committed
修复 点击弹窗后弹窗消失后,再次弹窗时,快速靠近弹窗弹窗消失的bug。
1 parent b27ffe0 commit 75647ba

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ RKOTextView *textViewWithCode = [RKOTextView textViewWithFrame:frame
7979
### RKOTopAlert
8080
8181
<p align="left">
82-
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.1-brightgreen.svg"></a>
82+
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.2-brightgreen.svg"></a>
8383
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
8484
<a href=""><img src="https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b5152950834.svg"></a>
8585
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
@@ -90,7 +90,7 @@ RKOTextView *textViewWithCode = [RKOTextView textViewWithFrame:frame
9090
#### 集成:
9191
9292
```shell
93-
pod 'RKOTopAlert', '~> 1.0.1'
93+
pod 'RKOTopAlert', '~> 1.0.2'
9494
```
9595

9696
#### 使用:

RKOTopAlertManager/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RKOTopAlert
22

33
<p align="center">
4-
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.1-brightgreen.svg"></a>
4+
<a href=""><img src="https://img.shields.io/badge/pod-v1.0.2-brightgreen.svg"></a>
55
<a href=""><img src="https://img.shields.io/badge/ObjectiveC-compatible-orange.svg"></a>
66
<a href=""><img src="https://img.shields.io/badge/platform-iOS%207.0%2B-ff69b5152950834.svg"></a>
77
<a href="https://github.com/rakuyoMo/RKOTools/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat"></a>
@@ -30,7 +30,7 @@
3030
## 集成
3131

3232
```shell
33-
pod 'RKOTopAlert', '~> 1.0.1'
33+
pod 'RKOTopAlert', '~> 1.0.2'
3434
```
3535

3636
## 使用

RKOTopAlertManager/RKOTopAlert.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Pod::Spec.new do |s|
1010

1111
s.name = "RKOTopAlert"
12-
s.version = "1.0.1"
12+
s.version = "1.0.2"
1313
s.summary = "Appears at the top of the notification view"
1414
s.description = <<-DESC
1515
Appears at the top of the notification view
@@ -23,7 +23,7 @@ Pod::Spec.new do |s|
2323

2424
s.ios.deployment_target = "7.0"
2525

26-
s.source = { :git => "https://github.com/rakuyoMo/RKOControls.git", :tag => "1.0.4" } # #{s.version}
26+
s.source = { :git => "https://github.com/rakuyoMo/RKOControls.git", :tag => "1.0.5" } # #{s.version}
2727

2828
s.requires_arc = true
2929

RKOTopAlertManager/RKOTopAlert/RKOTopAlert/RKOTopAlert/RKOTopAlert.m

+9-6
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ @interface RKOTopAlert()
2323
// 文字的颜色。
2424
@property (nonatomic, strong) UIColor *textColor;
2525

26-
// 标记视图已经出现
27-
@property (nonatomic, assign) BOOL alertDidAppear;
26+
// 标记视图将要消失
27+
@property (nonatomic, assign) BOOL alertWillDisappear;
2828

2929
@end
3030

@@ -112,6 +112,8 @@ - (void)setText:(NSString *)text {
112112
// 出现的动画
113113
- (void)alertAppearWithDuration:(CGFloat)duration {
114114

115+
NSLog(@"alertAppearWithDuration");
116+
115117
// 如果已经被添加,则不再出现。
116118
if (self.superview) {
117119
return;
@@ -129,7 +131,6 @@ - (void)alertAppearWithDuration:(CGFloat)duration {
129131
self.frame = alertFrame;
130132
} completion:^(BOOL finished) { // 显示动画完成
131133
if (finished) {
132-
self.alertDidAppear = YES;
133134

134135
// duration秒后横幅自动消失
135136
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
@@ -144,14 +145,18 @@ - (void)alertAppearWithDuration:(CGFloat)duration {
144145
// 消失的动画。
145146
- (void)alertDisappear {
146147

147-
if (!self.alertDidAppear) {
148+
if (self.alertWillDisappear) {
149+
self.alertWillDisappear = NO;
148150
return;
149151
}
150152

151153
__block CGRect alertFrame = self.frame;
152154
//移除横幅动画,设置完全透明并从父视图中移除
153155
[UIView animateWithDuration:ALERT_DISAPPEAR_ANIMATE_DURATION
154156
animations:^{
157+
158+
self.alertWillDisappear = YES;
159+
155160
// 向上移动消失。
156161
alertFrame.origin.y = -topHight.alertViewH;
157162
self.frame = alertFrame;
@@ -165,8 +170,6 @@ - (void)alertDisappear {
165170
self.backgroundColor = nil;
166171
// 从父视图中移除。
167172
[self removeFromSuperview];
168-
169-
self.alertDidAppear = NO;
170173
}
171174
}];
172175
}

0 commit comments

Comments
 (0)