ios - 带有来电通知的状态栏高度

标签 ios objective-c statusbar

我想获取状态栏的高度。这个我平时用的

[UIApplication sharedApplication].statusBarFrame.size.height

但是当我在模拟器中按下 Cmd + Y 时,会出现调用状态栏并且我的 View Controller 会向下移动。

有没有类似top的函数获取这个调用状态栏的高度?

谢谢

最佳答案

根据 Apple 文档:

UIApplicationWillChangeStatusBarFrameNotification

Posted when the app is about to change the frame of the status bar. The userInfo dictionary contains an NSValue object that encapsulates a CGRect structure expressing the location and size of the new status bar frame. Use UIApplicationStatusBarFrameUserInfoKey to access this value.

访问状态栏新框架的CGRect后,可以计算出“调用状态栏”的高度等于{frame of status bar}.origin.y

关于ios - 带有来电通知的状态栏高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21479564/

相关文章:

ios - 更改 IOS 7 状态栏内容颜色

iOS - 单击按钮隐藏状态栏

android - 防止隐藏的状态栏在屏幕锁定后重新出现

ios - pod boost 安装错误 tar : Unrecognized archive format

ios - 在 xcode 中混合 C 和 Objective-C

ios - 一个 View Controller 中的两个表

iphone - 将 unsigned char 数组转换为 NSData 并返回

ios - 从 presentModalViewController 推送 uiviewcontroller

ios - 带有自定义后退按钮字体的错误大标题动画

ios - 在类型 'overrideUserInterfaceStyle' 的对象上找不到属性 'DatePicker *'