ios - 防止关闭模态 WKInterfaceController

标签 ios modal-dialog watchkit modalviewcontroller wkinterfacecontroller

有没有办法防止用户关闭模态 Controller ?

我认为在要求用户打开 iPhone 对应界面或在那里执行某些操作时想要“阻止”主 Watch App 界面是很常见的。

我目前的解决方案是在 Controller 被解雇但笨拙时再次呈现 Controller 。

最佳答案

使用 reloadRootControllers 有一个有点笨拙的方法来解决这个问题。 .当您调用 reloadRootControllers(withNamesAndContexts:)名称为 WKInterfaceController您在 Storyboard 中命名的,它与以模态方式呈现该 Controller 具有类似的效果。但是,由于它现在是 Controller ,它没有取消按钮。我真的不喜欢这个,但它确实完成了工作。
请注意,此方法自 watchOS 4 以来已弃用。
Apple Documentation on reloadRootControllers(withNamesAndContexts:)

关于ios - 防止关闭模态 WKInterfaceController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36086152/

相关文章:

ios - swift 的 spritekit 声音设计

ios - 不使用dispatch_once_t转换Swift 3代码

ios - WatchKit应用提交失败;最小操作系统版本

javascript - 尝试使简单模态示例适应 asp.net 数据列表转发器

angularjs - $uibModalInstance 未定义(AngularJS UI.Bootstrap)

ios - 检测点击 WatchKit 中的 WKInterfaceLabel 或 WKInterfaceGroup

ios - iOS 开发人员如何称呼页面底部指示应用程序中打开的窗口数的点?

ios - 没有自动换行的 UILabel

ios - 如何在 swift3 中从 UIView 传递数据 UIViewContoller

angular - 以编程方式打开 ng-bootstrap 模式