{      
    self.imagePickerController = [[[UIImagePickerController alloc] init ] autorelease];
    imagePickerController.view.frame=CGRectMake(0, 0, 1024, 768);
    self.imagePickerController.delegate = self;
    [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
    //Set Notifications so that when user rotates phone, the orientation is reset to landscape.
    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    //Refer to the method didRotate:   
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(didRotate:)
                                                 name:@"UIDeviceOrientationDidChangeNotification" object:nil];
    //Set the picker source as the camera   
    self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    //Bring in the picker view   
    [self presentModalViewController:self.imagePickerController animated:YES];
}
            Asked
            
        
        
            Active
            
        
            Viewed 458 times
        
    1
            
            
        
        Aditya
        
- 4,414
 - 5
 - 29
 - 40
 
        Tejas Golwala
        
- 25
 - 3
 
- 
                    So which Problem do you have,can you explain?? – Ankit Gupta Apr 20 '12 at 06:39
 - 
                    [try this link][1] [1]: http://stackoverflow.com/questions/538041/uiimagepickercontroller-camera-preview-is-portrait-in-landscape-app – Ankit Gupta Apr 20 '12 at 06:58
 - 
                    After executing Above code i got BAD_Excess – Tejas Golwala Apr 20 '12 at 11:19
 
1 Answers
-2
            
            
        Here is my code this may help you
-(void)cameraAction
{
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType =  UIImagePickerControllerSourceTypeCamera;
// Delegate is self
imagePicker.delegate = self;
// Allow editing of image ?
imagePicker.allowsEditing = NO;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
    // Show image picker
    [self presentModalViewController:imagePicker animated:YES];  
}
else{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error accessing the camera"
                                                    message:@"Camera did not respond" delegate:nil
                                          cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; 
    [alert show]; 
    [alert release];
 }
}
 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    [picker release];
    [self dismissModalViewControllerAnimated:NO];
    editImageView=[[EditImageViewController alloc] initWithNibName:@"EditImageViewController" bundle:[NSBundle mainBundle]];
    editImageView.delegate=self;
    [self presentModalViewController:editImageView animated:YES];
    [editImageView.imgView setImage:image];
}
but this is not custom uiimagepickerviewcontroller but using this you can take photo in both modes.Try this...
        Sandhya Shettigar
        
- 299
 - 4
 - 12
 
- 
                    question is regarding custom camera in landscape only and you are answering about taking picture in both the modes. Also i cannot get the picture in landscape mode. You should post the EditImageViewController class too which does this functionality – Ronak Nov 07 '12 at 06:32