//小心下面这个问题
[self presentViewController:self completion:nil];
//获取当前屏幕显示的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];