UIImagePickerController在解散时搞乱了tabbar框架
我想在UITabBarController内的UIViewController中显示UIImagePickerController
SourceType相机
MediaType kUTTypeMovie
显示UIImagePickerController没有任何问题,但是当解散TabBar下移一半的高度时,它只会有时发生…其他它完全解散。
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") }) }
它也显示这个错误:
“对未渲染的视图进行快照会导致空的快照,确保在屏幕更新之后,快照或快照之前,您的视图至less已渲染一次。
这里是一个如何应用程序和错误的video:
这已经在这里问了:
Redbar在解散UIImagePickerController时注意到
解雇时我也注意到了红色的状态栏,用这个解决了:
您应该在.plist中将“基于视图控制器的状态栏外观”值设置为YES