mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2025-02-24 10:12:53 +08:00
#42 toast not showing on top of InAppBrowser on iOS
#55 Again/Still? Toast won't show in front of InAppBrowser on iOS
This commit is contained in:
parent
5634e1d84c
commit
03320113b4
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-plugin-x-toast",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.1",
|
||||
"description": "This plugin allows you to show a Toast. A Toast is a little non intrusive buttonless popup which automatically disappears.",
|
||||
"cordova": {
|
||||
"id": "cordova-plugin-x-toast",
|
||||
|
@ -2,7 +2,7 @@
|
||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="cordova-plugin-x-toast"
|
||||
version="2.2.0">
|
||||
version="2.2.1">
|
||||
|
||||
<name>Toast</name>
|
||||
|
||||
|
@ -114,13 +114,10 @@ static UIView *prevToast = NULL;
|
||||
toast.exclusiveTouch = YES;
|
||||
}
|
||||
|
||||
if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedAscending) {
|
||||
// on iOS8 when InAppBrowser is active, the Toast is below it,
|
||||
[self.superview.superview addSubview:toast];
|
||||
} else {
|
||||
// ..on iOS7 however with this fix on landscape the Toast isn't rotated automatically
|
||||
[self.superview addSubview:toast];
|
||||
}
|
||||
// make sure that if InAppBrowser is active, we're still showing Toasts on top of it
|
||||
UIViewController *vc = [self getTopMostViewController];
|
||||
UIView *v = [vc view];
|
||||
[v addSubview:toast];
|
||||
|
||||
[UIView animateWithDuration:CSToastFadeDuration
|
||||
delay:0.0
|
||||
@ -135,6 +132,14 @@ static UIView *prevToast = NULL;
|
||||
|
||||
}
|
||||
|
||||
- (UIViewController*) getTopMostViewController {
|
||||
UIViewController *presentingViewController = [[[UIApplication sharedApplication] delegate] window].rootViewController;
|
||||
while (presentingViewController.presentedViewController != nil) {
|
||||
presentingViewController = presentingViewController.presentedViewController;
|
||||
}
|
||||
return presentingViewController;
|
||||
}
|
||||
|
||||
- (void)hideToast {
|
||||
if (prevToast){
|
||||
[self hideToast:prevToast];
|
||||
|
Loading…
Reference in New Issue
Block a user