我正在通过依赖服务使用Xamarin Auth,它提供了一个用户身份验证的新视图但是,当模态页面出现并且完全可见时,它会上下跳动,显示此黑条 它很快消失,页面加载如下:隐藏页面顶部。提前致谢
我尝试了以下内容:
UIWindow window = UIApplication.SharedApplication.KeyWindow;
UIViewController viewController = window.RootViewController;
UIViewController AuthVC = auth.GetUI();
AuthVC.EdgesForExtendedLayout = UIRectEdge.None;
AuthVC.ExtendedLayoutIncludesOpaqueBars = false;
AuthVC.AutomaticallyAdjustsScrollViewInsets = false;
viewController.EdgesForExtendedLayout = UIRectEdge.None;
viewController.ExtendedLayoutIncludesOpaqueBars = false;
viewController.AutomaticallyAdjustsScrollViewInsets = false;
viewController.PresentViewController(AuthVC, true, null);
来自Auth.GetUI()的UIViewController来自这个包:https://github.com/xamarin/Xamarin.Auth
答案 0 :(得分:0)
这是我的临时解决方案,它仍然会闪烁,但如果加载后看起来是正确的。有谁知道什么会导致黑条闪烁?
viewController.PresentViewController(AuthVC, true, new Action(() =>
{
var MainUIView = AuthVC.View.Subviews[0];
var MainNavBar = AuthVC.View.Subviews[1];
var NavBarHeight = MainNavBar.Frame.Y + MainNavBar.Frame.Height;
MainUIView.Frame = new CoreGraphics.CGRect(0, NavBarHeight, MainUIView.Frame.Width, MainUIView.Frame.Height - NavBarHeight);
}));
答案 1 :(得分:0)
试试这个
viewController.NavigationController.PresentViewController(AuthVC, true, new Action(() =>
{
var MainUIView = AuthVC.View.Subviews[0];
var MainNavBar = AuthVC.View.Subviews[1];
var NavBarHeight = MainNavBar.Frame.Y + MainNavBar.Frame.Height;
MainUIView.Frame = new CoreGraphics.CGRect(0, NavBarHeight, MainUIView.Frame.Width, MainUIView.Frame.Height - NavBarHeight);
}));