This repository was archived by the owner on Jul 6, 2026. It is now read-only.
forked from huami1314/DYYY
-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathDYYYToast.m
More file actions
545 lines (463 loc) · 22 KB
/
Copy pathDYYYToast.m
File metadata and controls
545 lines (463 loc) · 22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
#import "DYYYToast.h"
#import "DYYYUtils.h"
@interface DYYYToast ()
@property(nonatomic, strong) CAShapeLayer *progressLayer;
@property(nonatomic, strong) UILabel *percentLabel;
@property(nonatomic, assign) CGFloat progress;
@property(nonatomic, strong) UIVisualEffectView *blurEffectView;
@property(nonatomic, strong) CAShapeLayer *checkmarkLayer;
@property(nonatomic, strong) UIView *progressView;
@property(nonatomic, assign) BOOL isShowingSuccessAnimation;
@end
@implementation DYYYToast
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// 设置透明背景
self.backgroundColor = [UIColor clearColor];
self.userInteractionEnabled = YES;
self.isCancelled = NO;
self.allowSuccessAnimation = NO;
BOOL isDarkMode = [DYYYUtils isDarkMode];
CGFloat containerWidth = 160;
CGFloat containerHeight = 40;
_containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerWidth, containerHeight)];
_containerView.center = CGPointMake(CGRectGetMidX(self.bounds), 130);
_containerView.backgroundColor = [UIColor clearColor];
_containerView.layer.cornerRadius = containerHeight / 2;
_containerView.clipsToBounds = YES;
_containerView.userInteractionEnabled = YES;
// 添加毛玻璃效果
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:isDarkMode ? UIBlurEffectStyleDark : UIBlurEffectStyleLight];
_blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
_blurEffectView.frame = _containerView.bounds;
_blurEffectView.layer.cornerRadius = containerHeight / 2;
_blurEffectView.clipsToBounds = YES;
[_containerView addSubview:_blurEffectView];
[self addSubview:_containerView];
_containerView.layer.shadowColor = [UIColor blackColor].CGColor;
_containerView.layer.shadowOffset = CGSizeMake(0, 2);
_containerView.layer.shadowRadius = 6;
_containerView.layer.shadowOpacity = 0.2;
CGFloat circleSize = 30;
CGFloat yCenter = containerHeight / 2;
// 修改为属性而非局部变量
_progressView = [[UIView alloc] initWithFrame:CGRectMake(10, (containerHeight - circleSize) / 2, circleSize, circleSize)];
[_containerView addSubview:_progressView];
CAShapeLayer *backgroundLayer = [CAShapeLayer layer];
UIBezierPath *circularPath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(circleSize / 2, circleSize / 2)
radius:circleSize / 2 - 2 // 稍微减小半径
startAngle:-M_PI / 2
endAngle:3 * M_PI / 2
clockwise:YES];
backgroundLayer.path = circularPath.CGPath;
UIColor *separatorColor = isDarkMode ? [UIColor colorWithWhite:0.4 alpha:1.0] : [UIColor colorWithWhite:0.85 alpha:1.0];
backgroundLayer.strokeColor = separatorColor.CGColor;
backgroundLayer.fillColor = [UIColor clearColor].CGColor;
backgroundLayer.lineWidth = 2;
backgroundLayer.lineCap = kCALineCapRound;
[_progressView.layer addSublayer:backgroundLayer];
_progressLayer = [CAShapeLayer layer];
_progressLayer.path = circularPath.CGPath;
UIColor *progressColor =
isDarkMode ? [UIColor colorWithRed:48 / 255.0 green:209 / 255.0 blue:151 / 255.0 alpha:1.0] : [UIColor colorWithRed:11 / 255.0 green:195 / 255.0 blue:139 / 255.0 alpha:1.0];
_progressLayer.strokeColor = progressColor.CGColor;
_progressLayer.fillColor = [UIColor clearColor].CGColor;
_progressLayer.lineWidth = 2;
_progressLayer.lineCap = kCALineCapRound;
_progressLayer.strokeEnd = 0;
[_progressView.layer addSublayer:_progressLayer];
_percentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, containerWidth, containerHeight)];
_percentLabel.textAlignment = NSTextAlignmentCenter;
_percentLabel.textColor = isDarkMode ? [UIColor colorWithWhite:0.9 alpha:1.0] : [UIColor colorWithWhite:0.2 alpha:1.0];
_percentLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_percentLabel.text = @"下载中... 0%";
CGFloat progressViewRightEdge = _progressView.frame.origin.x + _progressView.frame.size.width;
CGFloat labelWidth = containerWidth - progressViewRightEdge;
_percentLabel.frame = CGRectMake(progressViewRightEdge - 3, 0, labelWidth, containerHeight);
_percentLabel.textAlignment = NSTextAlignmentCenter;
[_containerView addSubview:_percentLabel];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
[_containerView addGestureRecognizer:tapGesture];
self.alpha = 0;
}
return self;
}
- (void)setProgress:(float)progress {
// 确保在主线程中更新UI
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self setProgress:progress];
});
return;
}
// 进度值限制在0到1之间
progress = MAX(0.0, MIN(1.0, progress));
_progress = progress;
// 设置环形进度
_progressLayer.strokeEnd = progress;
// 更新进度百分比
int percentage = (int)(progress * 100);
_percentLabel.text = [NSString stringWithFormat:@"下载中... %d%%", percentage];
}
- (void)show {
UIWindow *window = [DYYYUtils getActiveWindow];
if (!window) {
window = UIApplication.sharedApplication.windows.firstObject;
}
if (!window) {
return;
}
[window addSubview:self];
[UIView animateWithDuration:0.3
animations:^{
self.alpha = 1.0;
}];
}
- (void)dismiss {
void (^dismissBlock)(void) = ^{
if (self.isCancelled) {
[self showCancelAnimation:nil];
return;
}
if (self.allowSuccessAnimation) {
if (!self.isShowingSuccessAnimation) {
self.isShowingSuccessAnimation = YES;
[self showSuccessAnimation:nil];
}
return;
}
[UIView animateWithDuration:0.2
animations:^{
self.alpha = 0;
}
completion:^(BOOL finished) {
[self removeFromSuperview];
}];
};
if ([NSThread isMainThread]) {
dismissBlock();
} else {
dispatch_async(dispatch_get_main_queue(), dismissBlock);
}
}
- (void)handleTap:(UITapGestureRecognizer *)gesture {
self.isCancelled = YES;
if (self.cancelBlock) {
self.cancelBlock();
}
[self dismiss];
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if (self.hidden || self.alpha == 0) {
return nil;
}
CGPoint containerPoint = [self convertPoint:point toView:_containerView];
if ([_containerView pointInside:containerPoint withEvent:event]) {
return [super hitTest:point withEvent:event];
}
return nil;
}
// 下载成功动画方法
- (void)showSuccessAnimation:(void (^)(void))completion {
BOOL isDarkMode = [DYYYUtils isDarkMode];
UIColor *successColor =
isDarkMode ? [UIColor colorWithRed:48 / 255.0 green:209 / 255.0 blue:151 / 255.0 alpha:1.0] : [UIColor colorWithRed:11 / 255.0 green:195 / 255.0 blue:139 / 255.0 alpha:1.0];
[UIView animateWithDuration:0.3
animations:^{
[self setProgress:1.0];
}
completion:^(BOOL finished) {
CAShapeLayer *circleLayer = [CAShapeLayer layer];
CGFloat circleSize = 30;
UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, circleSize, circleSize)];
circleLayer.path = circlePath.CGPath;
circleLayer.fillColor = successColor.CGColor;
circleLayer.opacity = 0;
[self.progressView.layer addSublayer:circleLayer];
CAShapeLayer *checkmarkLayer = [CAShapeLayer layer];
UIBezierPath *checkPath = [UIBezierPath bezierPath];
[checkPath moveToPoint:CGPointMake(circleSize * 0.25, circleSize * 0.5)];
[checkPath addLineToPoint:CGPointMake(circleSize * 0.45, circleSize * 0.7)];
[checkPath addLineToPoint:CGPointMake(circleSize * 0.75, circleSize * 0.3)];
checkmarkLayer.path = checkPath.CGPath;
checkmarkLayer.fillColor = nil;
checkmarkLayer.strokeColor = [UIColor whiteColor].CGColor;
checkmarkLayer.lineWidth = 2.5;
checkmarkLayer.lineCap = kCALineCapRound;
checkmarkLayer.lineJoin = kCALineJoinRound;
checkmarkLayer.strokeEnd = 0;
[self.progressView.layer addSublayer:checkmarkLayer];
[UIView animateWithDuration:0.15
animations:^{
self.progressLayer.opacity = 0;
[UIView transitionWithView:self.percentLabel
duration:0.2
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
self.percentLabel.text = @"下载完成";
}
completion:nil];
}
completion:^(BOOL finished) {
CABasicAnimation *circleAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
circleAnimation.fromValue = @0.0;
circleAnimation.toValue = @1.0;
circleAnimation.duration = 0.1; // 从0.2改为0.1
circleLayer.opacity = 1.0;
[circleLayer addAnimation:circleAnimation forKey:@"fadeIn"];
__weak __typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
DYYYToast *toast = weakSelf;
if (!toast) {
return;
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DYYYHapticFeedbackEnabled"]) {
UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init];
[feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess];
}
CABasicAnimation *checkmarkAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
checkmarkAnimation.fromValue = @0.0;
checkmarkAnimation.toValue = @1.0;
checkmarkAnimation.duration = 0.15; // 从0.3改为0.15
checkmarkAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
checkmarkLayer.strokeEnd = 1.0;
[checkmarkLayer addAnimation:checkmarkAnimation forKey:@"drawCheckmark"];
[UIView animateWithDuration:0.15 // 从0.2改为0.15
delay:0.1
usingSpringWithDamping:0.6
initialSpringVelocity:0.8
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
toast.progressView.transform = CGAffineTransformMakeScale(1.15, 1.15);
}
completion:^(BOOL finished) {
[UIView animateWithDuration:0.2
animations:^{
toast.progressView.transform = CGAffineTransformIdentity;
}];
}];
__weak __typeof(toast) innerWeakToast = toast;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
DYYYToast *innerToast = innerWeakToast;
if (!innerToast) {
return;
}
[UIView animateWithDuration:0.2 // 从0.3改为0.2
animations:^{
innerToast.alpha = 0;
}
completion:^(BOOL finished) {
[innerToast removeFromSuperview];
if (completion) {
completion();
}
}];
});
});
}];
}];
}
// 下载取消动画方法
- (void)showCancelAnimation:(void (^)(void))completion {
BOOL isDarkMode = [DYYYUtils isDarkMode];
UIColor *cancelColor = isDarkMode ? [UIColor colorWithRed:52 / 255.0 green:152 / 255.0 blue:219 / 255.0 alpha:1.0] : [UIColor colorWithRed:41 / 255.0 green:128 / 255.0 blue:185 / 255.0 alpha:1.0];
// 创建圆形背景
CAShapeLayer *circleLayer = [CAShapeLayer layer];
CGFloat circleSize = 30;
UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, circleSize, circleSize)];
circleLayer.path = circlePath.CGPath;
circleLayer.fillColor = cancelColor.CGColor;
circleLayer.opacity = 0;
[self.progressView.layer addSublayer:circleLayer];
CAShapeLayer *crossLayer = [CAShapeLayer layer];
UIBezierPath *crossPath = [UIBezierPath bezierPath];
[crossPath moveToPoint:CGPointMake(circleSize * 0.7, circleSize * 0.3)];
[crossPath addLineToPoint:CGPointMake(circleSize * 0.3, circleSize * 0.7)];
[crossPath moveToPoint:CGPointMake(circleSize * 0.3, circleSize * 0.3)];
[crossPath addLineToPoint:CGPointMake(circleSize * 0.7, circleSize * 0.7)];
crossLayer.path = crossPath.CGPath;
crossLayer.fillColor = nil;
crossLayer.strokeColor = [UIColor whiteColor].CGColor;
crossLayer.lineWidth = 2.5;
crossLayer.lineCap = kCALineCapRound;
crossLayer.lineJoin = kCALineJoinRound;
crossLayer.strokeEnd = 0;
[self.progressView.layer addSublayer:crossLayer];
[UIView animateWithDuration:0.15
animations:^{
self.progressLayer.opacity = 0;
[UIView transitionWithView:self.percentLabel
duration:0.2
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
self.percentLabel.text = @"已取消下载";
}
completion:nil];
}
completion:^(BOOL finished) {
CABasicAnimation *circleAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
circleAnimation.fromValue = @0.0;
circleAnimation.toValue = @1.0;
circleAnimation.duration = 0.1; // 从0.2改为0.1
circleLayer.opacity = 1.0;
[circleLayer addAnimation:circleAnimation forKey:@"fadeIn"];
__weak __typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
DYYYToast *toast = weakSelf;
if (!toast) {
return;
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DYYYHapticFeedbackEnabled"]) {
UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init];
[feedbackGenerator notificationOccurred:UINotificationFeedbackTypeError];
}
// 绘制叉号
CABasicAnimation *crossAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
crossAnimation.fromValue = @0.0;
crossAnimation.toValue = @1.0;
crossAnimation.duration = 0.15; // 从0.3改为0.15
crossAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
crossLayer.strokeEnd = 1.0;
[crossLayer addAnimation:crossAnimation forKey:@"drawCross"];
[UIView animateWithDuration:0.15 // 从0.2改为0.15
delay:0.1
usingSpringWithDamping:0.6
initialSpringVelocity:0.8
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
toast.progressView.transform = CGAffineTransformMakeScale(1.15, 1.15);
}
completion:^(BOOL finished) {
[UIView animateWithDuration:0.2
animations:^{
toast.progressView.transform = CGAffineTransformIdentity;
}];
}];
__weak __typeof(toast) innerWeakToast = toast;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
DYYYToast *innerToast = innerWeakToast;
if (!innerToast) {
return;
}
[UIView animateWithDuration:0.2 // 从0.3改为0.2
animations:^{
innerToast.alpha = 0;
}
completion:^(BOOL finished) {
[innerToast removeFromSuperview];
if (completion) {
completion();
}
}];
});
});
}];
}
+ (void)showSuccessToastWithMessage:(NSString *)message {
DYYYToast *toast = [[DYYYToast alloc] initWithFrame:[UIScreen mainScreen].bounds];
[toast showSuccessToastWithMessage:message completion:nil];
}
- (void)showSuccessToastWithMessage:(NSString *)message completion:(void (^)(void))completion {
UIWindow *window = [DYYYUtils getActiveWindow];
if (!window) {
window = UIApplication.sharedApplication.windows.firstObject;
}
if (!window) {
return;
}
for (UIGestureRecognizer *gesture in self.containerView.gestureRecognizers) {
[self.containerView removeGestureRecognizer:gesture];
}
[window addSubview:self];
self.percentLabel.text = message ?: @"成功";
self.progressLayer.opacity = 0;
[UIView animateWithDuration:0.2
animations:^{
self.alpha = 1.0;
}
completion:^(BOOL finished) {
[self directlyShowSuccessAnimation:completion];
}];
}
- (void)directlyShowSuccessAnimation:(void (^)(void))completion {
BOOL isDarkMode = [DYYYUtils isDarkMode];
UIColor *successColor =
isDarkMode ? [UIColor colorWithRed:48 / 255.0 green:209 / 255.0 blue:151 / 255.0 alpha:1.0] : [UIColor colorWithRed:11 / 255.0 green:195 / 255.0 blue:139 / 255.0 alpha:1.0];
CAShapeLayer *circleLayer = [CAShapeLayer layer];
CGFloat circleSize = 30;
UIBezierPath *circlePath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, circleSize, circleSize)];
circleLayer.path = circlePath.CGPath;
circleLayer.fillColor = successColor.CGColor;
circleLayer.opacity = 0;
[self.progressView.layer addSublayer:circleLayer];
CAShapeLayer *checkmarkLayer = [CAShapeLayer layer];
UIBezierPath *checkPath = [UIBezierPath bezierPath];
[checkPath moveToPoint:CGPointMake(circleSize * 0.25, circleSize * 0.5)];
[checkPath addLineToPoint:CGPointMake(circleSize * 0.45, circleSize * 0.7)];
[checkPath addLineToPoint:CGPointMake(circleSize * 0.75, circleSize * 0.3)];
checkmarkLayer.path = checkPath.CGPath;
checkmarkLayer.fillColor = nil;
checkmarkLayer.strokeColor = [UIColor whiteColor].CGColor;
checkmarkLayer.lineWidth = 2.5;
checkmarkLayer.lineCap = kCALineCapRound;
checkmarkLayer.lineJoin = kCALineJoinRound;
checkmarkLayer.strokeEnd = 0;
[self.progressView.layer addSublayer:checkmarkLayer];
CABasicAnimation *circleAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
circleAnimation.fromValue = @0.0;
circleAnimation.toValue = @1.0;
circleAnimation.duration = 0.1;
circleLayer.opacity = 1.0;
[circleLayer addAnimation:circleAnimation forKey:@"fadeIn"];
__weak __typeof(self) weakSelf = self;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
DYYYToast *toast = weakSelf;
if (!toast) {
return;
}
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DYYYHapticFeedbackEnabled"]) {
UINotificationFeedbackGenerator *feedbackGenerator = [[UINotificationFeedbackGenerator alloc] init];
[feedbackGenerator notificationOccurred:UINotificationFeedbackTypeSuccess];
}
CABasicAnimation *checkmarkAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
checkmarkAnimation.fromValue = @0.0;
checkmarkAnimation.toValue = @1.0;
checkmarkAnimation.duration = 0.15;
checkmarkAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
checkmarkLayer.strokeEnd = 1.0;
[checkmarkLayer addAnimation:checkmarkAnimation forKey:@"drawCheckmark"];
[UIView animateWithDuration:0.15
delay:0.1
usingSpringWithDamping:0.6
initialSpringVelocity:0.8
options:UIViewAnimationOptionCurveEaseInOut
animations:^{
toast.progressView.transform = CGAffineTransformMakeScale(1.15, 1.15);
}
completion:^(BOOL finished) {
[UIView animateWithDuration:0.2
animations:^{
toast.progressView.transform = CGAffineTransformIdentity;
}];
}];
__weak __typeof(toast) innerWeakToast = toast;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
DYYYToast *innerToast = innerWeakToast;
if (!innerToast) {
return;
}
[UIView animateWithDuration:0.2
animations:^{
innerToast.alpha = 0;
}
completion:^(BOOL finished) {
[innerToast removeFromSuperview];
if (completion) {
completion();
}
}];
});
});
}
@end