//In AppDelegate.m, I am forcing every window to LandScapeRight.
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
return UIInterfaceOrientationMaskLandscapeRight;
}
//In ScanViewController.m, I am accessing camera and Image Library.
@implementation ScanViewController
-(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAll;
}
//Select photo from iPhone Image Library.
- (IBAction)photoFromAlbum:(id)sender
{
UIImagePickerController *photoPicker = [[UIImagePickerController alloc] init];
photoPicker.delegate = self;
photoPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:photoPicker animated:YES completion:NULL];
}
//Take photo from camera
- (IBAction)photoFromCamera:(id)sender
{
UIImagePickerController *photoPicker = [[UIImagePickerController alloc] init];
photoPicker.delegate = self;
photoPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:photoPicker animated:YES completion:NULL];
}
//Save the Image
- (void)imagePickerController:(UIImagePickerController *)photoPicker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
self.saveButton.enabled = YES;
self.filterButton.enabled = YES;
originalImage = [info valueForKey:UIImagePickerControllerOriginalImage];
[self.selectedImageView setImage:originalImage];
[self dismissViewControllerAnimated:YES completion:nil];
}
Now, I am getting this error "PLUICameraViewController shouldAutorotate is returning YES". I am using iOS 8 and I want my application to work in landscape mode, but when I access "ScanViewController.m", then it can be both Landscape or portrait because I read that in iOS8, it is compulsory, when accessing camera to have portrait view. Any suggestions are more than welcome.