iPad: [UIScreen mainScreen].bounds returns wrong co-ordinates
Asked Answered
C

1

6

[UIScreen mainScreen].bounds returns (0,0,768,1024) even when the iPad is in Landscape mode.

It should return (0,0,1024,768) but instead it returns (0,0,768,1024).

What could be wrong?

Commissariat answered 19/8, 2011 at 10:11 Comment(4)
When are you pulling the CGRect with the erroneous values? Before/during/after the rotation animation?Sharkey
This chap had a similar problem. Can you do like him and get bounds from a better-behaved object?Reconsider
@Sold Out Activist: I am launching the app in landscape mode so it is before rotation.So Rotation is not involved in this.Commissariat
Note that on iOS 8, the behavior has changed so that the value returned by bounds does depend on the orientation.Rupee
M
6

Nothing's wrong. This is how it works unfortunately.

See this question: Returning incorrect rectangle on landscape application launch

Mulderig answered 19/8, 2011 at 12:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.