我有一个关于如何在iOS上检测设备方向的问题.我不需要接收更改通知,只需要接收当前方向.这似乎是一个相当简单的问题,但我无法绕过它.以下是我到目前为止所做的事情:
UIDevice *myDevice = [UIDevice currentDevice] ;
[myDevice beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation deviceOrientation = myDevice.orientation;
BOOL isCurrentlyLandscapeView = UIDeviceOrientationIsLandscape(deviceOrientation);
[myDevice endGeneratingDeviceOrientationNotifications];
Run Code Online (Sandbox Code Playgroud)
在我看来这应该工作.我启用设备接收设备方向通知,然后询问它的方向,但它不起作用,我不知道为什么.
我对iOS的UITabBarController标签栏有疑问.
我正在使用a UITabBarController来显示一些视图,但我希望视图能够以尽可能大的屏幕显示.是否可以隐藏标签栏以使其通常不显示,直到用户触摸屏幕,然后标签栏将(带动画)显示在底部.然后,几秒钟后,如果没有任何操作,那么标签栏将再次消失,以便视图再次返回全屏?