【发布时间】:2019-06-28 18:25:10
【问题描述】:
【问题讨论】:
【问题讨论】:
使用文本编辑器打开您的 info.plist。应该有两个方向部分,您可以在其中定义每个成语的方向,如下所示
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
如果这不能正常工作,您也可以在代码中解决这个问题。在 AppDelegate.cs 中尝试覆盖 GetSupportedInterfaceOrientations。
public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations
(
UIApplication application,
[Transient] UIWindow forWindow
)
{
// You will need to figure out how to determine what kind of device you're on. I suggest Xamarin.Essentials, they probably have a service for that.
if (iPhone)
{
return UIInterfaceOrientationMask.Portrait;
}
if (iPad)
{
return UIInterfaceOrientationMask.AllButUpsideDown;
}
return UIInterfaceOrientationMask.All;
}
【讨论】: