码迷,mamicode.com
首页 > 移动开发 > 详细

iOS开发之获取最上层 Window

时间:2019-09-17 11:01:03      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:iap   nbsp   obj   continue   get   tor   edit   end   editing   

方法一:

-(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

标签:iap   nbsp   obj   continue   get   tor   edit   end   editing   

原文地址:https://www.cnblogs.com/hecanlin/p/11532241.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!