1

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

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

在此处输入图像描述

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

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

    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];
4

1 回答 1

1

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

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

于 2014-03-08T19:35:39.983 回答