I upgraded both my iPhone and SDK to iOS 4.0.1 and now my App doesn't run the same way it was running in iOS 3.x.
My App uses the UIImagePickerController with a custom cameraOverlayView (which I'll suppress in this post). The main point is that I need to see the iphone camera in fullscreen mode. To go straight to the problem, I'll put some code and screenshots to explain what's happening.
I created a View-Based Application using the XCode Template projects named "CameraTransform", so I got two classes: CameraTransformAppDelegate
and CameraTransformViewController
, ok! In the CameraTransformViewController
's viewDidAppear
method I put the following code:
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
//[self configurePicker_FirstAttempt:picker]; Use this!
//[self configurePicker_SecondAttempt:picker]; Use this too!
[self presentModalViewController:picker animated:YES];
}
- (void)configurePicker_FirstAttempt:(UIImagePickerController*) picker {
picker.showsCameraControls = NO;
picker.navigationBarHidden = YES;
// not needed (use defaults)
//picker.toolbarHidden = YES;
//picker.wantsFullScreenLayout = YES;
}
- (void)configurePicker_SecondAttempt:(UIImagePickerController*) picker {
// Transform values for full screen support
CGFloat cameraTransformX = 1.0;
CGFloat cameraTransformY = 1.12412;
picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, cameraTransformX, cameraTransformY);
}
Running the project with/i got:
- both
configurePicker_FirstAttempt
andconfigurePicker_SecondAttempt
method calls commented: defaultPicker.png. - only
configurePicker_SecondAttempt
method call commented: configurePicker_FirstAttempt.png. - both
configurePicker_FirstAttempt
andconfigurePicker_SecondAttempt
method calls uncommented: configurePicker_SecondAttempt.png.
NOTE:
- In iOS 3.x I used the third approach (both methods uncommented) to configure the picker, which was show in the fullscreen mode without the "black bar" at the bottom.
- I inspected the
picker.cameraViewTransform
original value (before being scaled) and it is set to Identity (as expected). - The
picker.view.frame
is set to the screen bounds's (0.0, 0.0, 320.0, 480.0) - I tried to concatenate a translation to the
picker.cameraViewTransform
(after being scaled), like this:CGAffineTransformTranslate(picker.cameraViewTransform, 0.0, 20.0);
and I realized that there was some part of the "camera view" that was hidden (maybe it's origin wasn't the 0.0, 0.0), so I got more "camera view" on screen.
It looks like in the new SDK the UIImagePickerController has changed in some way, maybe the camera controls have different sizes os something alike.
Has anyone had this problem?