forked from github/Toast-PhoneGap-Plugin
Merge pull request #13 from mrichie/master
prevent multiple Toast overlaps in iOS - testing it now
This commit is contained in:
commit
218832b269
@ -46,6 +46,8 @@ static const BOOL CSToastHidesOnTap = YES; // excludes activity
|
||||
static const NSString * CSToastTimerKey = @"CSToastTimerKey";
|
||||
static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey";
|
||||
|
||||
static UIView *prevToast = NULL;
|
||||
|
||||
@interface UIView (ToastPrivate)
|
||||
|
||||
- (void)hideToast:(UIView *)toast;
|
||||
@ -91,6 +93,10 @@ static const NSString * CSToastActivityViewKey = @"CSToastActivityViewKey";
|
||||
}
|
||||
|
||||
- (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.alpha = 0.0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user