0
我想添加水龙头,以专注于我的自定义相机视图,我设法做到这一点,但现在我需要显示的东西,使用户可以知道他实际上在做一些事情。 ......展示一个像苹果黄色广场或SnapChat白色圆圈的用户界面。自定义指标...可视化水龙头视图,显示水龙头指示器
这里是我的代码:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let screenSize = view.bounds.size
if let touchPoint = touches.first {
let x = touchPoint.location(in: view).y/screenSize.height
let y = 1.0 - touchPoint.location(in: view).x/screenSize.width
let focusPoint = CGPoint(x: x, y: y)
if let device = captureDevice {
do {
try device.lockForConfiguration()
device.focusPointOfInterest = focusPoint
//device.focusMode = .continuousAutoFocus
device.focusMode = .autoFocus
//device.focusMode = .locked
device.exposurePointOfInterest = focusPoint
device.exposureMode = AVCaptureExposureMode.continuousAutoExposure
device.unlockForConfiguration()
}
catch {
// just ignore
}
}
}
}
现在,我怎么添加自定义指标上触摸对焦?谢谢
因此,如果我将在draw func中添加图像,它会被看到? – RandomGeek
我已经扩展了示例代码,以显示如何在覆盖视图中绘制关于可变触摸点的正方形。 – Spads