我需要删除相机屏幕中的变焦滑块。
这是我的代码:

import UIKit

extension UIImagePickerController {
    class func sourceCameraModePhoto(_ delegate: UIImagePickerControllerDelegate & UINavigationControllerDelegate, overlayView: UIView) -> UIImagePickerController {
        let picker = UIImagePickerController()
        picker.sourceType = .camera
        picker.cameraCaptureMode = .photo
        picker.showsCameraControls = false
        picker.view.addSubview(overlayView)
        picker.delegate = delegate
        return picker
    }

ios - 如何在UIImagePickerController中删除缩放滑块-LMLPHP

最佳答案

我猜找到了这个问题的答案:
缩放滑块是UISlider,如果imagePickerController的view属性在其子视图下包含UISlider,则可以将其alpha设置为零。如果升级到iOS10,则会发生此问题。

func subviews(_ view: UIView) -> [UIView] {
    return view.subviews + view.subviews.flatMap { subviews($0) }
}

let myViews = subviews(imagePickerController.view)
for view in myViews {
    if view is UISlider {
        view.alpha = 0.0
    }
}

我希望这有帮助。

让我知道是否有更好的解决方案。

关于ios - 如何在UIImagePickerController中删除缩放滑块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42933460/

10-16 04:08