0

Is there any way to get the orientation of the phone itself without having all orientations selected as supported orientations.

For example, my app only supports portrait orientation. If a user turns their phone sideways to landscape mode, is there anyway I am able to know that?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Michael Jajou
  • 312
  • 2
  • 13
  • Not sure, but have you tried overriding anything related to your view controller? Specifically `viewDidLayoutSubviews()` and `viewWillTransition(toSize:)`. These are the "typical" places to check anything orientation oriented. –  Jul 20 '17 at 00:26
  • Have you looked at `UIDevice`? – rmaddy Jul 20 '17 at 00:36
  • This question is not a duplicate. My problem is only portrait orientation is the supported orientation, and i need to find a way to be able to tell when the user turns their phone sideways. – Michael Jajou Jul 20 '17 at 01:14
  • Understood. Still, **have** you tried anything? I usually ask for code on my first comment. You haven't shown any. So my next question is - *What have you tried? And can you be specific as to what isn't working?* –  Jul 20 '17 at 01:19

0 Answers0