Creating a single function that display fullscreen camera.

Discussion in 'iOS Programming' started by Bracer, Dec 14, 2009.

  1. Bracer macrumors newbie

    Nov 24, 2009
    I am trying to create a single function that will call up the camera to fullscreen.

    This code hang the program :(
    	UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    	picker.delegate = self;
    	picker.showsCameraControls = NO;
    	picker.navigationBarHidden = YES;
    	picker.toolbarHidden = YES;
    	picker.wantsFullScreenLayout = YES;
    	picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, CAMERA_SCALAR, CAMERA_SCALAR);
    	picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    	[self presentModalViewController:picker animated:YES]; //Show the Picker
    	[picker release];
    Can anyone help in accessing the problem with this code ?
  2. miep macrumors newbie

    Jul 6, 2007
    move the [release picker] statement to the dealloc of the class?

    Don't know about presentModalViewController, but if it returns immediately, releasing the picker at that spot (which you've set as the delegate) sort of pulls the rug out from under its feet.
  3. ghayenga macrumors regular

    Jun 18, 2008
    No, that's the standard method. The viewController hierarchy maintains it's own reference to it so if you don't release it you'll probably end up leaking pickers, because the a) the parent object may not get released until the app closes and b) you may call up the camera picker multiple times while the app is open.
  4. Bracer thread starter macrumors newbie

    Nov 24, 2009
    I have find out how it's done and I am going to create a separate thread to share it with the community.

Share This Page