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