Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Bracer

macrumors newbie
Original poster
Nov 24, 2009
14
0
I am trying to create a single function that will call up the camera to fullscreen.

This code hang the program :(
Code:
-(void)setCameraFullScreen
{
	
	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 ?
 

miep

macrumors newbie
Jul 6, 2007
14
0
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.
 

ghayenga

macrumors regular
Jun 18, 2008
190
0
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.

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.
 

Bracer

macrumors newbie
Original poster
Nov 24, 2009
14
0
I have find out how it's done and I am going to create a separate thread to share it with the community.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.