iOS: Device orientation on load

前端 未结 16 1903
遥遥无期
遥遥无期 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:12

    Try This one [[UIApplication sharedApplication] statusBarOrientation];

    or implement this one in app delegate

    (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
    {
        UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
    }
    

    it works

提交回复
热议问题