Self.view.frame unexpectedly resized in landscape mode

I set the view controller view through IB. The view is set to landscape with a width of 480 and a height of 320. It is correctly loaded into the simulator. However, when I checked self.frame.size using NSLog, I found that the frame size changed without any rotation of the device or any code. Here is what I get:

In viewDidLoad -> size = 480 x 320

In the WillAppear view → size = 480 x 320

In viewDidAppear → size = 320 x 480

I only have codes in viewDidLoad, but not viewWillAppear and viewDidAppear. Does anyone know what happened behind the scenes? Thank.

+3
source share
1 answer

- :

NSLog("frame=%@ transform=%@", NSStringFromCGRect(self.frame), NSStringFromCGAffineTransform(self.transform));

, (1,0,0,1,0,0), 480x320, 90 & deg; (0,1, -1,0,0,0 0, -1,1,0,0,0) 320x480.

?

, viewDidLoad ( , viewWillAppear) , . , UIKit , .

?

, "" , UIWindow. ; . .

, self.view.bounds.

+14

Source: https://habr.com/ru/post/1760860/


All Articles