xamarin - 如果我尝试以编程方式旋转 iPad 模拟器,它不会旋转
问题描述
我试图在 Xamarin.iOS 中以编程方式旋转模拟器,如下面的代码片段所示,
public void ChangeOrientation(string mode)
{
// Need to rotate the device to the landscape mode.
if (mode == "Landscape")
{
UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.LandscapeRight), new NSString("orientation"));
}
else
{
// Need to rotate the device to the potrait mode.
UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.Portrait), new NSString("orientation"));
}
}
如果我调用上述方法,模拟器应该旋转。实际上,iPhone 模拟器是旋转的。但 iPad 模拟器没有旋转。有什么建议么?
在此先感谢,迪瓦卡。
解决方案
这是工作示例应用程序的链接https://github.com/ramyareddyn/RotationSample
希望能帮助到你!
推荐阅读
- python - 添加一个while循环以不断询问名称,直到用户键入退出
- python - ValueError: 时间数据 'In 00 days 23:07:56' 与格式 'In %d days %H:%M:%S' 不匹配
- javascript - RegExp 不是确定性的吗?
- python - 使用 PySCIPopt 的参数化向量
- c++ - 从文件中读取索引是缓冲区溢出漏洞吗?
- sql - 如何在整个数据库中快速有效地推出索引
- ios - 使用 Linphone 在 lpConfigStringForKey 上应用程序崩溃
- swift - Swift Expression 隐含地从 'Any??' 强制转换 去任何?'
- mysql - 在mysql中使用sum() over(Partion by)组合多行数据
- excel - Nee If 函数获取输出