Question

I want to embed an augmented reality controller into a custom view controller and i make this into viewDidLoad method of custom Controller.

These lines makes the job for me:

_arViewController = [[ARViewController alloc] initWithDelegate:self];
_arViewController.showsCloseButton = false;
[_arViewController setRadarRange:60];
[_arViewController setOnlyShowItemsWithinRadarRange:YES];


[self addChildViewController:_arViewController];
[[self view] addSubview:[_arViewController view]];
[_arViewController didMoveToParentViewController:self];

All work fine when i get into controller in Portrait mode and rotate the device.

Although when i get into controller in landscape mode and rotate the device in portrait the camera shows me only tha 1/2 of the view and the rest is blank.

If i replace the 3 last lines of the code above and push _arViewController to self.navigationController again all work fine for both orientations.

Can anyone help me with this issue? I prefer no to push the arController but have it into customViewController.

The project that i embedded into my App is the below:

iPhone -AR - Toolkit

Was it helpful?

Solution

First off all look at apple referce, it has some properties that might help you in block rotation: https://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

In my point of view something like this may help you, just add method in .m file and implement correctly

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
            [_arViewController.view setFrame:self.view.frame];
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top