其他分享
首页 > 其他分享> > iOS开发之获取最上层 Window

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;

标签:return,win,iOS,UIWindow,UIApplication,Window,topView,sharedApplication,最上层
来源: https://www.cnblogs.com/hecanlin/p/11532241.html