Reputation: 1
When I entered an app in portrait mode and forced to switch to landscape mode, there was a problem, [[UIApplication sharedApplication] delegate].window ≠ [[UIScreen mainScreen] bounds].size :
UIWindow *keyWindow = [[UIApplication sharedApplication] delegate].window;
Their length and width are opposite,why? by the way, [[UIScreen mainScreen] bounds].size is right size;
Upvotes: 0
Views: 142
Reputation: 10199
The problem is the coordinate system that the frame and the bounds belong to:
bounds
belongs to the coordinate system as seen from the "inside" of a view, whereas frame
to the coordinate system of the "outside" belongs.
Think of CGAffineTransform
: If you rotate or scale a view, it's frame changes, but the bounds stay the same.
Upvotes: 0