iPad frame width and height mixup in landscape

后端 未结 2 370
无人及你
无人及你 2021-02-03 11:08

I have done what this question said here: Landscape Mode ONLY for iPhone or iPad

but the view.frame.size.height is still 1024, which is the height when the device is in

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-03 11:40

    You haven't specified which "view" you're querying. Assuming this is the top level subview of the window:

    You should query the view's bounds not its frame. frame is in the coordinate in which the view is defined (the outside world) hence may remain constant as you rotate. bounds is the coordinate used "inside" the view and for its subviews. This does change when you rotate.

提交回复
热议问题