当前位置:编程学习 > wap >>

获取UIWindow

1,UIWindow *window = [UIApplication sharedApplication].keyWindow;   // 获得根窗口
2.
 
- (UIView *)rootView {
 
  
 
  UIView *rootView = self;
 
  while (rootView.superview) {
 
    if ([rootView.superview isKindOfClass:[UIWindow class]]) {
 
      break;
 
    }
 
    rootView = rootView.superview;
 
  }
 
  return rootView;
 
}
 
补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,