我试图用我自己的视图覆盖状态栏,为此我通过执行类似的操作(也在旋转之后)为我的视图计算框架:
UIScreen *screen = [UIScreen mainScreen];
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
对于 iOS8+(因为 ios8UIScreen
依赖于方向):
CGRect frame = [screen.coordinateSpace convertRect:statusBarFrame toCoordinateSpace:screen.fixedCoordinateSpace];
[self setFrame:frame];
对于 iOS7:
[self setFrame:statusBarFrame];
它适用于 iOS8 及更低版本,但在使用 Xcode 7 beta 4 和 iOS 9 SDK 构建我的应用程序时,在横向或倒置启动应用程序时出现问题(如果应用程序以纵向启动,它工作正常)...
IE。当我在Upsidedown时启动应用程序时,应该覆盖状态栏的自定义uiwindow总是会出现在屏幕的底部,有什么想法可能有问题吗?