模态与push导致弹出半透明背景不同

 GroupViewController *gruop = [[GroupViewController alloc]init];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:gruop];
    [self presentViewController:nav animated:YES completion:nil];

当使用这种方式进行模态跳转时,你获取到的

// 半透明背景
    _bgImage= [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, XBScreenWidth, XBScreenHeight)];
    // 当前控制器的view
    [[UIApplication sharedApplication].keyWindow.rootViewController.view addSubview:_bgImage];
    _bgImage.backgroundColor = [UIColor blackColor];
    _bgImage.alpha = 0.5;

[UIApplication sharedApplication].keyWindow.rootViewController.view
会是你模态跳转的那个界面。
模态与push导致弹出半透明背景不同_第1张图片

如果你通过

GroupViewController *group = [[GroupViewController alloc]init];
    [self.navigationController pushViewController:group animated:YES];

push , 半透明界面会显示在你当前的界面

模态与push导致弹出半透明背景不同_第2张图片

你可能感兴趣的:(iOS技术之UI)