I am trying to show a UIImagePickerController in a UIViewController inside a UITabBarController
SourceType
MediaType kUTTypeMovie Camera
There is no problem presenting the UIImagePickerController, but when fired, the TabBar moves to half height, sometimes it only happens ... the other is fine.
override func viewDidLoad() {
var test: UIButton = UIButton(frame:CGRectMake(140, 200, 100, 100))
test.backgroundColor = UIColor.redColor()
test.addTarget(self, action:"presentCamera", forControlEvents: .TouchDown)
self.view.addSubview(test)
}
func presentCamera(){
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera){
imag.mediaTypes = [kUTTypeMovie]
imag.delegate = self
imag.sourceType = UIImagePickerControllerSourceType.Camera;
imag.videoQuality = UIImagePickerControllerQualityType.TypeMedium
imag.videoMaximumDuration = 120
imag.allowsEditing = false
self.presentViewController(imag, animated: true, completion:{println("showing")})
}
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
let library = ALAssetsLibrary()
var videoTemp = info[UIImagePickerControllerMediaURL] as NSURL
videoPath = videoTemp.relativePath
UISaveVideoAtPathToSavedPhotosAlbum(videoPath, self, nil, nil)
picker.dismissViewControllerAnimated(true, completion:{
println("video selected")
})
}
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
picker.dismissViewControllerAnimated(true, completion:{
println("canceled")
})
}
It also displays this error:
“A snapshot of a snapshot that was not displayed leads to a blank snapshot. Make sure your view has not been viewed before the snapshot or snapshot after updating the screen.”
Here's a video on how the application looks and the error:
https://www.youtube.com/watch?v=o1BgLbZgsfw