//小心下面這個(gè)問題
[self presentViewController:self completion:nil];
//獲取當(dāng)前屏幕顯示的Presented 出來的viewcontroller
+ (UIViewController *)getPresentedViewController
{
UIViewController *appRootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
UIViewController *topVC = appRootVC;
while (topVC.presentedViewController) {
if ([[topVC.presentedViewController class] isSubclassOfClass:[UINavigationController class]]) {
topVC = ((UINavigationController *)topVC.presentedViewController).viewControllers.lastObject;
}else{
topVC = topVC.presentedViewController;
}
}
return topVC;
}
//用getPresentedViewController解決
[KapHudManager.rootViewController presentViewController:alert animated:YES completion:nil];
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者