self.view.window在逻辑判断中的作用
2014-09-22 14:34
148 查看
- (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上,是无法看到的。
[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上,是无法看到的。
相关文章推荐
- self.view.window, self.view.superView的意思
- 关于self.window.rootViewController的方法调用顺序
- iphone - self.window.rootViewController vs window addSubview
- iOS 简单的实现手机号正误的判断(Warning: Attempt to present... whose view is not in the window hierarchy!
- Js使用window.parent ,window.top,window.self判断iframe嵌套
- 1.执行环境判断 window 或 self
- self.window.rootViewController都干了些啥事?
- 手势透过tableView 作用在self.View上
- iOS中添加逻辑流程(把创建的导航添加到window的rootview)
- 通过模态弹出视图 self.view.window.rootViewController灵活应用 modalTransitionStyle、modalPresentationStyle
- [ios]使用self.view.window.rootViewController presentViewControllert跳转后的返回
- 判断FormView,DetailsView是否为空,并改为insert模式。
- 数据库中null字段在逻辑层的判断的两种办法
- Sybase数据库中在SQL中嵌套简单逻辑判断
- 用SharePoint.OpenDocuments打开的文档如何控制它的ActiveWindow.View.ShowXMLMarkup(转)
- Provide an Alternative View to Data Using Splitter Window
- window对象的status、location、name、self、opener属性的使用
- 形式逻辑(普通逻辑)5:直言判断
- 逻辑运算(与&,或|,异或^)及其常用作用
- 当逻辑判断与或连用时——先与后或