如何翻译UIImagePickerController预览?

时间:2016-08-21 18:42:11

标签: ios swift uiimagepickercontroller

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

1 个答案:

答案 0 :(得分:1)

在网上拖网时找到答案:

// 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
// ...