UIImagePickerController UIAlertView之上

时间:2016-04-28 11:49:58

标签: ios camera uiimagepickercontroller uialertview

我正在开发一个应用程序,当UIAlertView呈现相机时,我需要UIImagePickerController出现在后台。目前,当出现相机控制器时,UIAlertView显示为超级视图(在相机上方)。

赞赏我们的想法。

2 个答案:

答案 0 :(得分:0)

您可以展示alertView,然后展示ImagepickerController。所以,当你忽略imagePickerController时,你会在viewController上看到alertView。

答案 1 :(得分:0)

AlertViews被添加到窗口而不是控制器。他们永远是最重要的。您可以在警报视图中显示选择器以重叠它。 你可以使用这个库 https://github.com/wimagguc/ios-custom-alertview

UIImagePickerController *cameraView = [[UIImagePickerController     alloc] init];

cameraView.sourceType = UIImagePickerControllerSourceTypeCamera;

cameraView.showsCameraControls = NO;
CustomIOSAlertView *alertView = [[CustomIOSAlertView alloc] init];
    UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screen.size.width, screen.size.height)];
    [container addSubview:cameraView.view];
    container.subviews.lastObject.center =  CGPointMake(container.subviews.lastObject.center.x, container.center.y);
    [alertView setContainerView:container];
    [alertView setDelegate:self];
    //    Display the dialog
[cameraView viewWillAppear:YES]; // trickery to make it show
[cameraView viewDidAppear:YES];
    [alertView show];