Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-21-2010, 06:32 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 5
Default Why is the Camera not in fullscreen?

Hi, my problem is that if I start the UIImagePickerController with a custom overlay view, the camera is not covering the whole screen?

See on your self:



You see the black gap between the camera preview and the toolbar? I don't know how to fix that.


Thats the code:

Code:
	self.camPicker = [[UIImagePickerController alloc] init];
	
	self.camPicker.delegate = self;
	self.camPicker.allowsEditing = NO;
	
	if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
		
		UIButton *takeButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-40)];
		[takeButton addTarget:self action:@selector(takeCamPic:) forControlEvents:UIControlEventTouchUpInside];
		[self.camOverlay addSubview:takeButton];
		
		
		
		self.camPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
		self.camPicker.showsCameraControls = NO;		
		self.camPicker.cameraOverlayView = camOverlay;	
		self.camPicker.toolbarHidden = YES;
		self.camPicker.navigationBarHidden = YES;
		self.camPicker.wantsFullScreenLayout = YES;
		
		
		
		
	} else
		self.camPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
	
	[self presentModalViewController:self.camPicker animated:YES];
The overlay view has the size 320*480 in the interface builder.

Did someone face the same problem?
robin1508 is offline   Reply With Quote
Old 03-26-2010, 05:16 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: Toronto, Ontario
Posts: 4
Default

Hi Robin...

The camera's image itself is not large enough and needs to be scaled to fit the space.

Add the following two lines after your "self.camPicker.wantsFullScreenLayout" line:

Code:
CGFloat camScaleup = 1.xxx;
self.camPicker.cameraViewTransform = CGAffineTransformScale(self.camPicker.cameraViewTransform, camScaleup, camScaleup);
You set the "1.xxx" based on how much space you need to fill up. In my case, I don't have a toolbar or any controls at all and so I needed to span 54 additional pixels. My value was therefore (480 / (480 - 54)), or 1.12676. In your case, it looks like your gap is smaller and you can use a value much closer to 1.000.

...Bill
Bill Hollings is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 157,869
Threads: 88,917
Posts: 379,300
Top Poster: BrianSlick (7,072)
Welcome to our newest member, homasen
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:19 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0