【发布时间】:2017-04-13 16:06:51
【问题描述】:
我正在结合 Mvvmcross 框架开发一个带有一个视图的简单 xamarin 表单应用程序。一切进展顺利,但在某个时间点,我注意到状态栏和所有系统控件(如警报、导航栏、后退按钮)与其他应用程序(仅在 iOS 平台上)相比尺寸有所增加。我已经尝试恢复所有更改,但没有成功,但这个错误仍然存在。使用 VS 2015 模板创建的其他测试应用程序运行良好。在Status bar size example,这种差异清晰可见。
在代码中,我只有一个带有 MainPage.xaml 视图的标准 Mvvmcross 设置,其中包含一个没有任何自定义效果或渲染器的 ContentPage。
iOS Setup.cs
protected override IMvxIosViewPresenter CreatePresenter()
{
Forms.Init();
var xamarinFormsApp = new App();
return new MvxFormsIosPagePresenter(Window, xamarinFormsApp);
}
iOS AppDelegate
[Register("AppDelegate")]
public partial class AppDelegate : MvxApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
var window = new UIWindow(UIScreen.MainScreen.Bounds);
var setup = new Setup(this, window);
setup.Initialize();
var startup = Mvx.Resolve<IMvxAppStart>();
startup.Start();
window.MakeKeyAndVisible();
return true;
}
}
iOS Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>XamarinFormsApp</string>
<key>CFBundleIdentifier</key>
<string>com.test.xamarintest</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleIconFiles</key>
<array />
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
</dict>
</plist>
【问题讨论】:
-
我已经看到这种情况发生了几次,但不确定我做了什么导致它。从应用程序切换器终止应用程序后,重置模拟器(或硬重启我正在测试的设备)似乎可以修复它。我认为这是一个被触发的辅助功能。
-
Keith Rome,有趣的考虑,但不幸的是,它没有解释为什么其他应用程序可以正常工作,无论它们在哪里启动:在设备或模拟器上。但是,在模拟器中启动我的应用程序、重新启动设备或重建应用程序都没有结果。
-
首先想到的就是它;不是在兼容模式下运行吗?这是通过添加正确的初始屏幕大小来确定的,例如参见this link,尽管现在这似乎不太可能是问题,因为所有模板都应该更新
标签: xamarin xamarin.forms mvvmcross