- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
我正在使用 Swift 3、Xcode 8.2。
我目前有一个应用程序,我可以让用户打开相机拍照。打开相机后,我希望出现一个警告框,为用户提供一些信息。在控制再次返回到相机之前,用户可以单击“完成”。
这是我的代码:
func openCameraAction() {
// Check if the camera is available on the device as a source type
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) {
// declare a variable of image picker controller
let imagePicker = UIImagePickerController()
// set its delegate, set its source type
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
// tell our image picker to not edit a captured picture
// which means that we won’t get the black screen with
// a square frame right after taking a photo.
imagePicker.allowsEditing = false
// present the camera controller, it will show up from the
// bottom of the screen, which is the default iOS animation
// for opening new screens.
self.present(imagePicker, animated: true, completion: nil)
}
}
func displayInstructions() {
let instructionController = UIAlertController(title: "Photo Instructions", message: "Some instruction here", preferredStyle: .alert)
let actionDone = UIAlertAction(title: "Done", style: .cancel) { (action:UIAlertAction) in
//This is called when the user presses the done button.
print("You've pressed the done button");
}
//Add the buttons
instructionController.addAction(actionDone)
//Present the instruction controller
self.present(instructionController, animated: true, completion: nil)
}
我已经尝试在 openCameraAction
中设置 completion
字段来调用方法 displayInstruction
但很快意识到我不能展示东西以嵌套的方式。我相信礼物必须从 Root View Controller 级别发生,对吗?
Attempt to present ... on ... whose view is not in the window hierarchy!
但是,有什么方法可以实现这种效果吗?做一些嵌套礼物?
感谢您的帮助。
编辑
我看了另一个问题,还是有点糊涂。我从其他答案中抓取了一段代码,但很难弄清楚如何将其集成到我的代码中。
var rootViewController = UIApplication.shared.keyWindow?.rootViewController
if let navigationController = rootViewController as? UINavigationController {
rootViewController = navigationController.viewControllers.first
}
if let tabBarController = rootViewController as? UITabBarController {
rootViewController = tabBarController.selectedViewController
}
rootViewController?.present(alertController, animated: true, completion: nil)
我是否将上述代码包含在 openCameraAction
或 displayInstruction
函数中?
我正在尝试在 IN sql 条件下使用数据库字段。我的字段是一串由逗号分隔的值(如 it,en,fr,de),我必须在 WHERE 子句中使用它,如下所示: WHERE d.iso639code =
他大家 我的以下代码有问题: import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp e
在处理 ReadOnlyMany 存储时,我正在努力理解 PersistentVolume 上的容量参数的概念,以及 PersistentVolumeClaim 上的存储请求。如果存储以只读方式安装
我试图让一个 while 循环在另一个 while 循环中工作,我之前已经让它工作过,但无法再次管理它。 我试图计算航类查询中的总记录,然后在小时记录中尝试添加时间。我已经让所有查询单独工作,但是当我
我们的数据库更新性能偶尔会大幅下降。 例如,表 FooTable 我们有大约 40 列与 varchar PK 此外还有 10 个索引。以下查询用时 44 秒,而在其他时候它几乎立即运行。在减速期间,
我可以在 Release模式下使用 Trace.WriteLine 吗? Trace.Write 和 Debug.Write 之间的主要区别是什么? 最佳答案 不同之处在于 Release模式。 当未
我刚刚遇到了一个非常奇怪的场景,并且在其他地方找不到任何相关信息。当 Xcode 在我的断点处中断时,整个系统的所有键盘输入都没有响应。我可以切换到另一个应用程序,但没有记录任何击键。 Xcode 本
我一直在尝试在一组 Raspberry Pi 上设置 K8s 集群。这是我的 GitHub 页面的链接,描述了整个设置: https://github.com/joesan/plant-infra/b
我的 pod 处于 Pending 状态,因为提到的所有答案我都试图获得描述输出但不知道为什么它保持在 Pending 状态: k8s@k8s-master:~/deployment$ kubectl
我已经开发了一个非消耗性的应用内购买iOS应用程序。我已经获取了应用内购买的 bundle 包标识符,并编写了代码并将其提交给appstore ...提交应用程序后,其状态显示在-App Purcha
我有 2 个具有一对多关系的实体,一个地址可以是多个员工。 MySQL 数据库: 地址 address_id INT PK AutoIncr 城市 VARCHAR 国家/地区 VARCHAR 员工 i
我想在我的项目中使用 ProGuard。我激活了选项 minifyEnabled。当我打开使用库 Retrofit2 的 Activity 时,应用程序崩溃并显示: 无法为接口(interface)
我刚刚在 MVC 应用程序中启用了 Application Insights,并注意到在本地调试时,我的 Azure Application Insight 中会捕获跟踪信息。 处于 Debug模式时
我正在使用一个启动和结束线程的类。线程是在构造函数中创建的。只要标志为 TRUE,线程函数就会继续循环。该标志是该类的静态成员。解构器将标志设置为 FALSE。这样,该类的每个实例都有一个关联的线程,
我有一个 Angular PWA。在我从 Angular 5.0 升级到 7.2 之前,它的 service worker 工作完美 升级后,我在/ngsw/state中看到以下错误 Driver s
可能有一些背景:当用户单击它时,我试图在可滚动的全屏 EditText 上方显示一个特定的键盘 View 。问题是如果光标位于 EditText 的底部,它会被弹出的键盘 View 隐藏。 与常规 I
当进度条处于 Activity 状态时禁用后台交互的正确方法是什么。 Box( modifier = Modifier.fillMaxSize(), contentAlignmen
这个问题在这里已经有了答案: Draw Rectangle inside picture box SizeMode Zoom (1 个回答) 关闭 3 年前。 我有一个 PictureBox1,其
我们刚刚开始在 kubernetes 上创建我们的集群。 现在我们尝试部署分蘖,但出现错误: NetworkPlugin cni failed to set up pod "tiller-deploy
我使用 NRPE 插件将一台 Linux 主机配置为 Nagios 监控服务器。 为此,我遵循以下 URL http://www.tecmint.com/how-to-add-linux-host-t
我是一名优秀的程序员,十分优秀!