如何加载第二个视图,可以通过它看到第一个视图(透明),在 ios 9

How to load second view ,that can see the first view thourgh it (transparent), in ios 9

这是我的问题,我认为我有两种看法。在第一个视图中有一个 imageview(带有图像)和一个 button.When 我按下按钮然后它加载第二个视图(以模态方式存在故事板 segue 类型)。当该视图加载时,我想设置第一个查看,通过第二个视图(应该是透明的)。

我尝试将 secondview 的默认视图 background color 设置为 default 但它给出了 black.how 我可以这样做吗?

您可以将一个 viewcontroller 的视图作为子视图添加到另一个视图。这样每个 viewcontroller 的代码都在它自己的 class 中,但它们显示在彼此之上。

MyViewController *viewController = [[MyViewController alloc] init];
[viewControllerA.view setFrame:CGRectMake(x, y, width, height)];
[self.view addSubview:viewController.view];

哦,我在几分钟的测试后解决了你的问题... 我发现 segue 有一个 属性 命名的演示文稿,就像这样:

您可以将 属性 更改为 Over Current Context 并且它有效

Select 你的 secondviewcontroller goto attribute inspector 然后 select 过渡风格到 'cover vertical' 和呈现到 'over current context'

并为 presentviewcontroller 编写代码以在 firstviewcontroller 中模态呈现您的第二个视图控制器。