如何翻译 UIImagePickerController 预览?

How to translate the UIImagePickerController preview?

当我打开 UIImagePickerController() 并设置 showsCameraControls = false 时,相机预览位于屏幕顶部。如何向下移动此预览,使其与 showCameraControls = true?

时的位置相同

网上拖网找到答案:

// Create the UIImagePickerController without camera controls
var imagePicker: UIImagePickerController = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = .Camera
imagePicker.allowsEditing = false
imagePicker.showsCameraControls = false

// Translate the camera preview down by 50px
let translate: CGAffineTransform = CGAffineTransformMakeTranslation(0.0, 50.0)
imagePicker.cameraViewTransform = translate

// Now add custom overlay
// ...