UIImagePickerController 在关闭时弄乱标签栏框架
UIImagePickerController messing tabbar frame when dismissing
我正在尝试在 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")
})
}
它还显示此错误:
"Snapshotting a view that has not been rendered results in an empty
snapshot. Ensure your view has been rendered at least once before
snapshotting or snapshot after screen updates."
这是应用程序和错误外观的视频:
这里已经有人问过了:
Redbar Noticed when dismissing UIImagePickerController
我也注意到解雇时的红色状态栏,使用这个解决了:
您应该在 .plist
中将 "View controller-based status bar appearance" 值设置为 YES
我正在尝试在 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")
})
}
它还显示此错误:
"Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates."
这是应用程序和错误外观的视频:
这里已经有人问过了:
Redbar Noticed when dismissing UIImagePickerController
我也注意到解雇时的红色状态栏,使用这个解决了:
您应该在 .plist
中将 "View controller-based status bar appearance" 值设置为 YES