UIImagePickerController

UIImagePickerController

本文介绍了关闭 UIImagePickerController 后屏幕尺寸错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像 whatsapp 这样的 iOS 应用程序 &...当我使用 UIImagePickerControllerSourceTypeCamera 源类型呈现 UIImagePickerController 时.

imagePicker = [UIImagePickerController new];imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;imagePicker.delegate = self;imagePicker.mediaTypes =[NSArray arrayWithObjects:(NSString *)kUTTypeMovie,(NSString *)kUTTypeImage,nil];[self presentViewController:imagePicker 动画:YES 完成:nil];

问题

有时在 Video 模式下取消或完成捕获 UIImagePickerController 后,当我回到我的 viewController(关闭相机)时,我的输入视图(我的 Windows)会到底部20 像素(状态栏高度),我认为我的问题与此链接有关

编辑

该解决方案仅适用于当前视图,但另一个视图控制器已损坏(转到底部)

解决方案

终于解决了

特别感谢 danialzahid94.

为了修复这个问题,你应该调用

[selfdismissViewControllerAnimated:YES 完成:^{self.view.frame = [[UIScreen mainScreen]bounds];[self.view layoutIfNeeded];self.tabBarController.view.frame = [[UIScreen mainScreen]bounds];[self.tabBarController.view layoutIfNeeded];//用于修复 tabbar Controller}];

在 2 个委托中:

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

I have an iOS app like whatsapp & ...when I present UIImagePickerController with UIImagePickerControllerSourceTypeCamera source type.

imagePicker = [UIImagePickerController new];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.mediaTypes =[NSArray arrayWithObjects:(NSString *)kUTTypeMovie,(NSString *)kUTTypeImage,nil];
[self presentViewController:imagePicker animated:YES completion:nil];

Problem

Some times after cancel or finish capturing UIImagePickerController in Video mode , when I back to my viewController (dismiss camera ) my input View (my Windows) going to bottom with 20 pixel ( status bar height ), I think my problem relate to this link How to position view below green bar during phone call? , because in video segment a recording status bar show for a few moment.In some condition my Windows (UITabbar in previous controller going to bottom as same ) !!!

Edit

the solution works only in current View but another View controller corrupt ( going to bottom )

解决方案

Finally it's Fiexed

special thanks to danialzahid94.

for Fix this issue , you should call

[self dismissViewControllerAnimated:YES completion:^{
        self.view.frame = [[UIScreen mainScreen]bounds];
        [self.view layoutIfNeeded];
        self.tabBarController.view.frame  = [[UIScreen mainScreen]bounds];
        [self.tabBarController.view layoutIfNeeded]; // for fixing  tabbar Controller 

    }];

in 2 Delegate :

这篇关于关闭 UIImagePickerController 后屏幕尺寸错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 10:43