0

strong textI have an iPad app which only allows landscape orientation, and launches in landscape orientation. I have a UIViewController and in the viewDidLoad I set the frame of the view:

self.view.frame = CGRectMake(0, 0, 1024, 728);

In a touchesBegan function in that same UIViewController I print out the view:

NSLog(@"%@",self.view);

and when I tap the screen get:

<UIView: 0x37e370; frame = (0 0; 768 1024); transform = [0, 1, -1, 0, 0, 0]; layer = <CALayer: 0x37e3d0>>

As you can see, the frame changes to [0,0,768,1024] (which is portrait iPad) instead of [0,0,1024,728] (which is what I defined it to be in the viewDidLoad method).

Why is it switching on me?

CodeGuy
  • 28,427
  • 76
  • 200
  • 317

1 Answers1

0

This is related to this other question of yours, no? iPad Landscape messing up touches began

Quoting your answer: " is that, when defining the UIWindow, it needs to be defined as

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

and not strict coordinates. "

Community
  • 1
  • 1
Fernando Madruga
  • 1,746
  • 13
  • 11