Get current orientation of iPad?

后端 未结 11 1725
野趣味
野趣味 2020-12-02 07:28

In a given event handler (not the \"shouldAutorotateToInterfaceOrientation\" method) how do I detect the current iPad orientation? I have a text field I have to animate up

11条回答
  •  Happy的楠姐
    2020-12-02 08:22

    For determining landscape vs portrait, there is a built-in function:

    UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
    BOOL inLandscape = UIDeviceOrientationIsLandscape(orientation);
    

提交回复
热议问题