ios - "Over Current Context"选项在 Xcode Storyboard 中不可用?

标签 ios xcode storyboard

在 Stack Overflow 上的这个回答中,Display clearColor UIViewController over UIViewController , 用户建议对模态视图 Controller 使用 Over Current Context 选项。

目标是通过 Storyboard创建一个透明的模态视图 Controller 。

但是 Over Current Context 选项不可用。只有 Current Context, 不会创建透明模态 Controller 。

最佳答案

一段时间以来一直在努力解决同样的问题,终于找到了解决方法。

使用 Xcode 7.2。

不确定发生这种情况的确切原因,但 Over Current Context 不是可用选项。这个项目是前一段时间创建的,我有预感可能与之相关。

current context

作为测试,我创建了一个全新的项目,Over Current Context 是一个选项。

over current context

由于无法删除并重新创建现有项目,因此我最终执行了以下操作:

  1. 将 segue 上的 Presentation 设置为 Default。这是为下一步做准备。

  2. 在目标 View Controller 场景中,在 Attributes Inspector 中将 Presentation 设置为 Over Current Context

destination view controller

我能够成功地看到半透明模态下方的父 View Controller 。

注意:

我支持 iOS 8 及更高版本,因此我不必为在父项和子项上设置 modalPresentationStyle 而烦恼。

失败的尝试:

  • prepareForSegue 的目标 View Controller 上将 modalPresentationStyle 设置为 .OverCurrentContext 对我不起作用,因为 Storyboard 设置似乎覆盖我的代码。

  • 设置 Defines ContextProvides Context 似乎没有什么区别。我猜这些可能会在某些应用程序架构中发挥作用,只是在我的特定项目中不会。

关于ios - "Over Current Context"选项在 Xcode Storyboard 中不可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31643273/

相关文章:

ios - 发送到实例的 UITableViewCell copyWithZone 无法识别的选择器

Xcode、Swift - 如何使用将参数作为选择器的函数

xcode - MacOSX 下 libpng 的链接器错误

ios - 警报完成未完全正常工作

ios - objective-c : dequeueReusableCellWithIdentifier:forIndexPath: returns exception

ios - 访问 socket 时发现为零

ios - Xcode 5 中的代码完成 - 不适用于 "for"和 "switch"语句

ios - 使用正则表达式在 ios 中标记字符串

ios - iOS 8 上的 snapshotViewAfterScreenUpdates 故障

xcode - 错误 : Can't run/Applications/Xcode. app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool(没有这样的文件)