2

(我英语说得不好TT)

我想要 uiviewcontroller 中的全屏 uiview。

我使用此代码。

  - (IBAction)addBtn:(id)sender {

    addView = [[AddView alloc] initWithFrame:CGRectZero];

    [[[UIApplication sharedApplication]delegate].window addSubview:addView];
    addView.window.windowLevel = UIWindowLevelStatusBar;

    [addView setAlpha:0.0f];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.35f];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    [addView setAlpha:1.0f];
    [UIView commitAnimations];
}

单击按钮 (+) 时

状态栏消失!!!!!!

当我在 ios6 中使用相同的代码时,它起作用了。但在 ios7 中不起作用。

为什么状态栏消失?

在这里查看我的源代码。

4

3 回答 3

1

在 viewdidLoad 函数中编写以下代码...

你的代码......///

[addView setAlpha:0.5];// make addsubview alpha 0.5

希望它会工作......我的朋友!!!!

快乐编码!!!!!!

于 2013-09-27T06:05:39.687 回答
0

您需要删除此行,addView.window.windowLevel = UIWindowLevelStatusBar;

- (IBAction)addBtn:(id)sender {

        addView = [[AddView alloc] initWithFrame:CGRectZero];

        [[[UIApplication sharedApplication]delegate].window addSubview:addView];
            // addView.window.windowLevel = UIWindowLevelStatusBar;

        [addView setAlpha:0.0f];

        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:0.35f];
        [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

        [addView setAlpha:1.0f];
        [UIView commitAnimations];
    }
于 2013-09-27T06:03:14.047 回答
0

您好,这是您的 addBtn 方法的代码。

-(IBAction)addBtn:(id)sender {

    addView = [[AddView alloc] initWithFrame:CGRectZero];

    [[[UIApplication sharedApplication]delegate].window addSubview:addView];
    addView.window.windowLevel = UIWindowLevelNormal;

    [addView setAlpha:0.0f];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.35f];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    [addView setAlpha:1.0f];
    [UIView commitAnimations];

}

现在工作正常。

于 2013-09-27T06:05:48.103 回答