UIView背后的图像选择器

时间:2015-04-20 10:32:46

标签: ios objective-c iphone

我在MainWindow前添加了UIView。我希望在那个视图中呈现相机选择器。但相机选择器始终位于UIView

之后

如何将拣货员带到前面。我已经检查了 bringSubviewToFront:但没有效果

用于呈现选择器的代码

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
        {
            UIImagePickerController * picker = [[UIImagePickerController alloc] init];
            picker.delegate = self;
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;
            picker.allowsEditing=TRUE;

            picker.allowsEditing = true;

            [navController presentViewController:picker animated:YES completion:nil];
        }

以下是用于将我的视图添加到窗口的代码。

[self.window addSubview:myView.view];
[myView didMoveToParentViewController:self.window.rootViewController];
[appDelegate.window bringSubviewToFront:myView];

提前致谢。

1 个答案:

答案 0 :(得分:0)

你试过这种方式吗?

UIImagePickerController * picker = [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    picker.delegate = self;
[<yourView> addSubview:picker.view];