gpt4 book ai didi

c# - SimpleOrientationSensor 返回 Null

转载 作者:行者123 更新时间:2023-11-30 16:21:54 24 4
gpt4 key购买 nike

我正在使用 SimpleOrientationSensor 在我的应用程序中获取屏幕方向信息。我正在 Windows 模拟器中测试此应用程序,但我总是将传感器对象的值设置为 null。

这就是我正在做的:

SimpleOrientationSensor sensor;

sensor = SimpleOrientationSensor.GetDefault();
if (sensor != null)
{
sensor.OrientationChanged += sensor_OrientationChanged;
}

我知道当没有可用的传感器时,SimpleOrientationSensor.GetDefault() 将返回 null。我应该调整模拟器以获取传感器信息吗?还是它甚至可以处理这些变化?

最佳答案

根据 this article模拟器不支持 SimpleOrientationSensor 类。

The Simulator doesn’t support the emulation of Orientation Sensor, and is only able to trigger a display orientation change.

关于c# - SimpleOrientationSensor 返回 Null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12853799/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com