陈玉杰
陈玉杰

Reputation: 1

why does[[UIApplication sharedApplication] delegate].window.bound ≠ [[UIScreen mainScreen] bounds].size

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;

enter image description here

Their length and width are opposite,why? by the way, [[UIScreen mainScreen] bounds].size is right size;

Upvotes: 0

Views: 142

Answers (1)

Andreas Oetjen
Andreas Oetjen

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

Related Questions