Xamarin and ios 10 - All Pages moved up behind Title Bar

人走茶凉 提交于 2019-12-04 19:24:16

To fix this issue, update to the latest version of the Xamarin Forms Nuget Package. To do this right click on your solution in Xamarin Studio and click Update Nuget Packages. This will update all of your NuGet Packages including the Xamarin.Forms nuget package, and will fix this issue.

Note that just installing the latest version of Xamarin Studio will not fix this, you must manually update the Nuget Packages!

Credit goes to @Scott for his help!!!

I had the same issue in my Xamarin.Forms app. What I had to do was set the NavigationBar translucent property to false through a custom renderer. If you're not using Forms, you can set this value in the ViewController itself.

        var navBar = this.NavigationController?.NavigationBar;
        if (navBar != null)
        {
            navBar.Translucent = false;
        }

Again, if you're not using forms, try setting the navigation bar's translucent property to false in the ViewController, or Storyboard.

I will say though, that for Forms, this was only required on older versions of Xamarin.Forms, and the latest version fixes this itself.

Edit: Quick (untested) Content Page renderer that should resolve this issue

using TestApp.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly:ExportRenderer(typeof(ContentPage), typeof(ContentPageRenderer))]
namespace TestApp.iOS
{
    public class ContentPageRenderer : PageRenderer
    {
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            var navBar = this.NavigationController?.NavigationBar;
            if (navBar != null)
            {
                navBar.Translucent = false;
            }
        }
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!