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",
|
"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.",
|
"description": "This plugin allows you to show a Toast. A Toast is a little non intrusive buttonless popup which automatically disappears.",
|
||||||
"cordova": {
|
"cordova": {
|
||||||
"id": "cordova-plugin-x-toast",
|
"id": "cordova-plugin-x-toast",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
id="cordova-plugin-x-toast"
|
id="cordova-plugin-x-toast"
|
||||||
version="2.2.0">
|
version="2.2.1">
|
||||||
|
|
||||||
<name>Toast</name>
|
<name>Toast</name>
|
||||||
|
|
||||||
|
@ -114,13 +114,10 @@ static UIView *prevToast = NULL;
|
|||||||
toast.exclusiveTouch = YES;
|
toast.exclusiveTouch = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedAscending) {
|
// make sure that if InAppBrowser is active, we're still showing Toasts on top of it
|
||||||
// on iOS8 when InAppBrowser is active, the Toast is below it,
|
UIViewController *vc = [self getTopMostViewController];
|
||||||
[self.superview.superview addSubview:toast];
|
UIView *v = [vc view];
|
||||||
} else {
|
[v addSubview:toast];
|
||||||
// ..on iOS7 however with this fix on landscape the Toast isn't rotated automatically
|
|
||||||
[self.superview addSubview:toast];
|
|
||||||
}
|
|
||||||
|
|
||||||
[UIView animateWithDuration:CSToastFadeDuration
|
[UIView animateWithDuration:CSToastFadeDuration
|
||||||
delay:0.0
|
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 {
|
- (void)hideToast {
|
||||||
if (prevToast){
|
if (prevToast){
|
||||||
[self hideToast:prevToast];
|
[self hideToast:prevToast];
|
||||||
|
Loading…
Reference in New Issue
Block a user