iOS开发之获取最上层 Window
Posted hecanlin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS开发之获取最上层 Window相关的知识,希望对你有一定的参考价值。
方法一:
-(UIWindow *)topLevelWindowGet
UIWindow *topView = [UIApplication sharedApplication].keyWindow;
for (UIWindow *win in [[UIApplication sharedApplication].windows reverseObjectEnumerator])
if ([win isEqual: topView])
continue;
if (win.windowLevel > topView.windowLevel && win.hidden != YES )
topView =win;
return topView;
方法二:
UIWindow *topView = [UIApplication sharedApplication].keyWindow;
[topView endEditing:Yes];
return topView;
以上是关于iOS开发之获取最上层 Window的主要内容,如果未能解决你的问题,请参考以下文章