About the orientation of iPhone

前端 未结 2 1967
野性不改
野性不改 2021-01-16 01:42

How to get the current orientation of iPhone? I surfed this site, and found two methods as followings.

  • [UIApplication sharedApplication].statusBarOrientation;<
2条回答
  •  感动是毒
    2021-01-16 02:16

    [[UIDevice currentDevice] orientation] gets the current physical orientation of the device. [UIApplication sharedApplication].statusBarOrientation gets the orientation of the UI. If the app ever returns NO to the shouldAutorotateToInterfaceOrientation: method, the two values will not be the same.

提交回复
热议问题