一句话搞定:
this.NavigationController.NavigationBar.Layer.MasksToBounds = true;
它很有效的,一般在做全屏界面的时候,如果你隐藏掉了NavigationBar的话,从没有隐藏的界面切换回来时,
界面顶部会有一块黑色的部分出现,虽然出现的时间很短,但给用户的体验很是不好,配合MasksToBounds属性,
我们给NavigationBar.SetBackgroundImage(。。。)设置一个图片,然后隐藏底部阴影,效果会很好,切诸多问
题都能解决.
/// <summary>
/// Is called when the view is about to appear on the screen. We use this method to hide the
/// navigation bar.
/// </summary>
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
this.NavigationController.SetNavigationBarHidden (true, animated);
}
/// <summary>
/// Is called when the another view will appear and this one will be hidden. We use this method
/// to show the navigation bar again.
/// </summary>
public override void ViewWillDisappear (bool animated)
{
base.ViewWillDisappear (animated);
this.NavigationController.SetNavigationBarHidden (false, animated);
}