- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    if (self.view.window == nil) {
        self.view = nil;
    }
}

iOS程序里面,window是程序视图层次体系的最高层。所有能看到的view,都是要加到这个window上才能被看到。

不管是直接被加到window上,还是通过superview被间接的加到window上,总之一个view你要想看到它,它必须要被加到一个window上去。

所以如果一个view的window属性为nil的话,就说明这个view没有被加到任何window上,是无法看到的。

相关文章:

  • 2022-12-23
  • 2021-05-20
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2021-04-30
猜你喜欢
  • 2022-01-04
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2021-07-22
相关资源
相似解决方案