From b469805b2d0c9b23ca020cf9356ff137205f856c Mon Sep 17 00:00:00 2001 From: 464027401@qq.com <464027401@qq.com> Date: 星期一, 27 九月 2021 10:22:10 +0800 Subject: [PATCH] 修复来点页面重复呼叫时alert位置不对问题 --- HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinPhoneCommon.m | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m" index d643489..87139e4 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinPhoneCommon.m" @@ -22,6 +22,37 @@ return topController; } ++(UIViewController *) rootController { + UIViewController*topController ; + if ([UIApplication sharedApplication].delegate.window) { + topController= [UIApplication sharedApplication].delegate.window.rootViewController; + }else{ + topController=[self appWindow].rootViewController; + } +// while(topController.presentedViewController){ +// topController=topController.presentedViewController; +// } + return topController; +} + ++(BOOL)rootPresentVCContent:(Class)vcClass{ + UIViewController*roootVC ; + if ([UIApplication sharedApplication].delegate.window) { + roootVC= [UIApplication sharedApplication].delegate.window.rootViewController; + }else{ + roootVC=[self appWindow].rootViewController; + } + while(roootVC.presentedViewController){ + if ([roootVC.presentedViewController isKindOfClass:vcClass]) { + return YES; + break; + } + roootVC=roootVC.presentedViewController; + } + + return NO; +} + +(UIWindow*)appWindow{ UIWindow *window; if (@available(iOS 13.0, *)) { -- Gitblit v1.8.0