mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2025-02-24 10:12:53 +08:00
prevent multiple Toast overlaps in ios
This commit is contained in:
parent
e6c1c89f14
commit
654dccb05a
@ -46,6 +46,8 @@ static const BOOL CSToastHidesOnTap = YES; // excludes activity
|
|||||||
static const NSString * CSToastTimerKey = @"CSToastTimerKey";
|
static const NSString * CSToastTimerKey = @"CSToastTimerKey";
|
||||||
static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey";
|
static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey";
|
||||||
|
|
||||||
|
static UIView *prevToast = NULL;
|
||||||
|
|
||||||
@interface UIView (ToastPrivate)
|
@interface UIView (ToastPrivate)
|
||||||
|
|
||||||
- (void)hideToast:(UIView *)toast;
|
- (void)hideToast:(UIView *)toast;
|
||||||
@ -91,6 +93,10 @@ static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)point {
|
- (void)showToast:(UIView *)toast duration:(NSTimeInterval)duration position:(id)point {
|
||||||
|
if(prevToast){
|
||||||
|
[self hideToast:prevToast];
|
||||||
|
}
|
||||||
|
prevToast = toast;
|
||||||
toast.center = [self centerPointForPosition:point withToast:toast];
|
toast.center = [self centerPointForPosition:point withToast:toast];
|
||||||
toast.alpha = 0.0;
|
toast.alpha = 0.0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user