iOS [UIApplcation sharedApplication].keyWindow.bounds 值为全0
来源:互联网 发布:微信 自定义回复 php 编辑:程序博客网 时间:2024/05/16 05:34
在取keyWindow的值时,由于keyWindow 是实时变化的,其值可能为0,用[UIScreen mainScreen].bounds 即可。
[UIScreen mainScreen].bounds vs [UIApplcation sharedApplication].keyWindow.bounds?
I have view that i want to cover entire screen. And i want to set its frame to cover entire screen. Browsing the stack overflow i found these two different ways of setting view frame to cover the screen:
[UIScreen mainScreen].bounds[UIApplcation sharedApplication].keyWindow.bounds
It seems to me they are returning same values always, or at least in few test cases I have tried.
Currently i am using UIScreen
, but i curious to know difference between these calls? Will there be some cases where they will return different values?
The methods are slightly different. [UIScreen mainScreen]
returns the devices UIScreen
object, the bounds of this will always be the size of the devices screen. [UIApplication sharedApplication].keyWindow
returns the current key UIWindow
for the application, which could conceivably not be the full size of the devices screen.
Another obvious case where these could differ is if the device is attached to multiple screens. In this case, [UIScreen mainScreen].bounds
will always return the devices screen size, but the key window could be on one of the other screens, and it will have a completely different size, depending on what kind of screen it is attached to.
- iOS [UIApplcation sharedApplication].keyWindow.bounds 值为全0
- 问题:iOS9获取[[UIApplication sharedApplication] keyWindow]为 nil
- [UIApplication sharedApplication].keyWindow
- [UIApplication sharedApplication].delegate.window [UIApplication sharedApplication].keyWindow
- [UIApplication sharedApplication].keyWindow 添加视图无效,解决方案。
- 13..[UIApplication sharedApplication].keyWindow,遇到的问题
- [UIApplication sharedApplication].keyWindow 添加视图无效,解决方案。
- [UIApplication sharedApplication].keyWindow与[UIApplication sharedApplication].delegate.window];;
- [UIApplication sharedApplication].keyWindow和[UIApplication sharedApplication].delegate.window
- sharedApplication,ios
- iOS—keyWindow
- IOS开发中的KeyWindow
- UIAlertView与[UIApplication sharedApplication].keyWindow.rootViewController的冲突解决
- [UIApplication sharedApplication].keyWindow 添加/切换视图无效,解决方案。
- iOS开发——KeyWindow
- keyWindow
- IOS UIApplication sharedApplication详解
- iOS-UIApplication sharedApplication 详解
- JS缓冲运动与透明渐变
- android setTag (int key, Object tag)抛出IllegalArgumentException的问题
- Android App整体架构设计的思考
- JS中的call()和apply()方法
- apache mesos 入门(4)——mesos中的资源
- iOS [UIApplcation sharedApplication].keyWindow.bounds 值为全0
- cuda介绍
- XML知识点总结
- \build\intermediates\res\xxx-stripped.ap_' specified for property 'resourceFile' does not exist
- Java ArrayList工作原理及实现
- 机器学习基础(五十三)—— 精确率与召回率(多分类问题精确率和召回率的计算)
- NSNotification通知
- 服务器运维
- [Drools]JAVA规则引擎 -- Drools