iOS: Device orientation on load

前端 未结 16 1947
遥遥无期
遥遥无期 2020-11-28 23:45

It seems that when my app loads, it does not know its current orientation:

UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
if (o         


        
16条回答
  •  星月不相逢
    2020-11-29 00:07

    One thing that nobody has touched on yet is that you’re storing UIDeviceOrientation types in a UIInterfaceOrientation variable. They are different, and should not be treated as equal. Note that UIDeviceOrientationLeft is equal to UIInterfaceOrientationRight (since the interface rotates the opposite way compared to the device).

提交回复
热议问题