“Incorrect” frame / window size after re-orientation in iPhone

前端 未结 3 451
南旧
南旧 2020-11-28 07:47

In my iPhone OS application I want (need) to watch for changes in the device orientation in order to rearrange certain portions of the screen. The approach I used was to use

3条回答
  •  执笔经年
    2020-11-28 07:52

    I've been stumbling over the same problem and with some diagnostic work I discovered that the view's bounds and frame do not accurately reflect the landscape orientation in viewDidLoad (when the device is held in landscape when the view controller is pushed onto the stack), but do so correctly in viewWillAppear: and viewDidAppear:. I just moved my code that needed the dimensions of the frame/bounds from viewDidLoad to viewWillAppear:, and it worked properly.

提交回复
热议问题