iiview deck controller changing frame without changing interface orientation on presenting modal view

308 Views Asked by At

I am using IIViewDeckController and facing a very weird problem as follows?:

My ViewController(which is an IIViewDeckController) is in landscape mode and then I present a new view controller modally on top of it. Now the modal view controller does not support landscape mode and thus is presented only in portrait mode.
As of now, everything went fine.

But as soon as I try to dismiss this modally presented controller, IIViewDeckController's view's frame becomes (320,568) (I think this IIViewDeckController has rotated to portrait mode but I am not sure for that). So I checked self.interfaceOrientation which showed "4"(i.e. UIInterfaceOrientationLandscapeLeft) which should be the actual case.

But these two things are confusing me as the frame is indicating the portrait mode and property shows something different. Now because of this frame changing without changing the interfaceOrientation is result into wrong calculation of objects' frames in the view.

1

There are 1 best solutions below

0
On

I faced the same problem, I solved it by categorizing IIViewDeckController inside AppDelegate class.

Following is the one method that was required to be categorized:-

@interface IIViewDeckController (categoryForOrientation)
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation;
@end

@implementation IIViewDeckController (categoryForOrientation)

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return [self interfaceOrientation];
}