user1858725
user1858725

Reputation: 1333

ipad camera interface orientation

I want to create iPad camera, before that I create iPhone camera app with portrait orientation.

When I choose photo from album (device album), iPad app throws an error:

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES'

Here is my code to choose photo from album:

UIImagePickerController *pickerController = [[UIImagePickerController alloc] init];
pickerController.delegate = self;
pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
pickerController.mediaTypes = @[(NSString *) kUTTypeImage];
pickerController.allowsEditing = NO;
[self presentViewController:pickerController animated:YES completion:nil];

What must I add to made it accessible from iPad with landscape orientation?

Upvotes: 0

Views: 565

Answers (2)

Alok kumar
Alok kumar

Reputation: 32

Its working fine but when we are launching the application it show portrait on left.. So please tell how we can restrict all portrait event. -(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow )window {if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) return UIInterfaceOrientationMaskAll;else / iphone */returnUIInterfaceOrientationMaskAllButUpsideDown; }

Upvotes: 0

user1858725
user1858725

Reputation: 1333

i found solution, case closed. i add in my appdelegate.m:

-(NSUInteger)application:(UIApplication *)application 
    supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationMaskAll;
    else  /* iphone */
        return UIInterfaceOrientationMaskAllButUpsideDown;
}

Upvotes: 1

Related Questions