开发者

UIImagePickerController Camera Bug??? (Looks like it is "Sent to Back")

开发者 https://www.devze.com 2023-03-06 01:07 出处:网络
I am creating a window-based application (I am using window-based because I like how the universal apps are organized), but I am having trouble with the UIImagePickerControllerSourceTypeCamera. I want

I am creating a window-based application (I am using window-based because I like how the universal apps are organized), but I am having trouble with the UIImagePickerControllerSourceTypeCamera. I want to have two views:

the parent view: a menu screen the sub view: the screen where you can choose the photo from a gallery or where you can use the camera to take a photo

The main issue is, when I push the button to take a picture with the camera, it works and I can see the camera controls, and I can even take a picture with no problem. However, whatever objects that are in the parent view are covering the "viewfinding" screen. (i.e. if I am pointing my camera to a flower, I can see the flower on the screen, but there are buttons and imageviews from the parent view overlayed on it. I hope that makes sense).

I am adding the ImagePickerController as a modal view. You can see the code below. When I choose photo from album, it seems to be working okay, but when I try to take a picture with the camera, it is like it is sent to the back of everything.

-(IBAction)se开发者_运维百科tImage:(id)sender{

  UIImagePickerController* picker = [[UIImagePickerController alloc] init];
  picker.delegate = self;

  if((UIButton *) sender == ChoosePhoto) {
      picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
  } else {
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
  }

  [self presentModalViewController:picker animated:YES];

}

Maybe I am just missing something really obvious. Any help would greatly be appreciated. Thanks!


It sounds like you are putting all your "subviews" into the UIWindow rather than into the root view controller's view. Don't do that, add them to the root view controller's view.

0

精彩评论

暂无评论...
验证码 换一张
取 消