Fahim Parkar
Fahim Parkar

Reputation: 31627

iPad in landscape gives wrong width and height

I am making iOS 7 app where I am finding width and height in landscape mode.

What I have is below in app delegate...

NSLog(@"self.window.frame.size.width==%f", self.window.frame.size.width);
NSLog(@"self.window.frame.size.height==%f", self.window.frame.size.height);

What I was expecting is

self.window.frame.size.width==1024
self.window.frame.size.height==768

However I get reversed output as

self.window.frame.size.width==768
self.window.frame.size.height==1024

Note: I have ticked ONLY Landscape Left and Right. I have not selected Potrait & Upside Down.

Any idea why this is happening?

I am doing this on iOS 7.

Upvotes: 1

Views: 1593

Answers (1)

gnasher729
gnasher729

Reputation: 151

The width and height of the screen and of the window in the screen don't change as the screen orientation changes, they will always be width = 768 and height = 1024 (until Apple makes an iPad with more pixels, like the height of iPhone's has changed).

In that screen window, you have a view controller with a root view. The size of that view will change with the screen orientation.

Upvotes: 3

Related Questions