首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >离开AVCaptureSession时停止ViewController

离开AVCaptureSession时停止ViewController
EN

Stack Overflow用户
提问于 2016-05-23 15:22:17
回答 1查看 1.1K关注 0票数 3

ViewController和AVCaptureSession在一起。我可以轻松启动和停止AVCaptureSession:

代码语言:javascript
复制
var captureSession: AVCaptureSession?
captureSession = AVCaptureSession()

//start
captureSession?.startRunning() 

//stop
captureSession?.stopRunning() 

A想知道当用户打开另一个AVCaptureSession时如何停止ViewController。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-23 15:32:08

只需让viewWillDisappear方法为您处理这个问题。

代码语言:javascript
复制
override func viewWillDisappear(animated: Bool) {
    super.viewWillDisappear(animated)
    captureSession?.stopRunning()
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37394814

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档