gpt4 book ai didi

ios - 如何让状态栏始终在最前面?

转载 作者:行者123 更新时间:2023-11-29 12:51:49 25 4
gpt4 key购买 nike

我确定这是一个快速修复或有一些设置但出于某种原因我无法在任何地方找到答案。

我在屏幕上的 UIImageView 始终排列在状态栏上方,即使我将它发送到后面,如图所示。

enter image description here

如何让状态栏始终保持在顶部?我将通过顶部边缘将图像向上滑动到屏幕之外,因此我希望它们保持在栏下方。

这是我的一些代码,我在其中生成图像并将其移出屏幕顶部:

    UIImage *towerBG = [UIImage imageNamed:@"towerbg.png"];
UIImageView *towerBGView = [[UIImageView alloc] initWithImage:towerBG];
towerBGView.frame = CGRectMake(0, 150, towerBGView.frame.size.width, towerBGView.frame.size.height);
[self.view addSubview:towerBGView];
[self.view sendSubviewToBack:towerBGView];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
towerBGView.frame = CGRectMake(0, -300, towerBGView.frame.size.width, towerBGView.frame.size.height);
[UIView commitAnimations];

最佳答案

问题不在于图像在状态栏的顶部,它在状态栏的下方,但状态栏是透明的,并且图像具有黑色 背景。黑底黑 = 黑。

在界面生成器中,在 View Controller 的属性中,取消选中Extended Edges 下的所有选项。这将使您的 View 不会出现在状态栏下。

关于ios - 如何让状态栏始终在最前面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22273562/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com