简体   繁体   English

使用UIImagePickerController拍摄视频和picker'view不能全屏显示吗?

[英]Using UIImagePickerController to take video and picker'view not full-screen?

I want to take video in my app running iOS7, then I use UIImagePickerController to do it. 我想在运行iOS7的应用中拍摄视频,然后使用UIImagePickerController进行操作。 But I find the picker's view not full-screen, appears 2 black view both on left and right? 但是我发现选择器的视图不是全屏显示,左右两侧都出现2个黑色视图? How to resize for full-screen. 如何调整大小以全屏显示。 Code like this: 像这样的代码:

  picker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie, nil];
  picker.videoQuality = UIImagePickerControllerQualityTypeIFrame1280x720;

I tried to set videoQuality with UIImagePickerControllerQualityType640x480, then appears 2 black view both on top and bottom. 我尝试使用UIImagePickerControllerQualityType640x480设置videoQuality,然后在顶部和底部均出现2个黑色视图。

And when present picker(on iOS7), how to change status bar style? 当当前选择器(在iOS7上)时,如何更改状态栏样式? Thanks. 谢谢。

you can use pickerViewcontroller Delegate to customer it,for example 您可以使用pickerViewcontroller委托给客户,例如

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    UIImagePickerController * picker  = (UIImagePickerController *) navigationController;
    if (picker.sourceType != UIImagePickerControllerSourceTypeCamera) {
        [viewController.navigationItem setTitle:@"请选择照片"];
        viewController.navigationItem.leftBarButtonItem = ....
        viewController.navigationItem.rightBarButtonItem =  ...     
        }
    }

}
CGSize screenSize       = CGSizeMake(320, 708);
float cameraAspectRatio = 4.0 / 3.0;
float imageWidth        = floorf(screenSize.width * cameraAspectRatio);
float scale             = ceilf((screenSize.height / imageWidth) * 10.0) / 10.0;
myImagePickerController.cameraViewTransform   = CGAffineTransformMakeScale(scale, scale);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM