0
与状态栏干扰我已经创建滑动菜单中Xamarin.iOS下面库https://github.com/thedillonb/MonoTouch.SlideoutNavigation的UITableView在Xamarin.iOS
SplashViewController.cs
window = new UIWindow(UIScreen.MainScreen.Bounds);
Menu = new SlideoutNavigationController();
var storyboard = UIStoryboard.FromName("Main", null);
var webController = storyboard.InstantiateViewController("HomeViewController") as HomeViewController;
Menu.MainViewController = new MainNavigationController(webController, Menu);
Menu.MenuViewController = new MenuNavigationController(new DummyControllerLeft(), Menu) { NavigationBarHidden = true };
window.RootViewController = Menu;
window.MakeKeyAndVisible();
DummyControllerLeft.cs
public override void ViewDidLoad()
{
base.ViewDidLoad();
TableView.Frame = new RectangleF((float)TableView.Frame.Left, 30, (float)TableView.Frame.Width, (float)(View.Frame.Size.Height - 30));
headerView = new UIView();
headerView.Frame = new CoreGraphics.CGRect(0, 0, TableView.Frame.Width, 140);
profileImage = new UIImageView();
profileImage.Frame = new CoreGraphics.CGRect(10, 10, 70, 70);
profileImage.Layer.CornerRadius = 35;
profileImage.ClipsToBounds = true;
profileImage.Image = UIImage.FromBundle("gargi_logo.png");
userName = new UILabel();
userName.Frame = new CoreGraphics.CGRect(10, 90, TableView.Frame.Width - 20, 20);
userName.Font = GargiFontAndSize.B14();
userName.TextColor = UIColor.White;
headerView.AddSubview(userName);
userRole = new UILabel();
userRole.Frame = new CoreGraphics.CGRect(10, 110, TableView.Frame.Width - 20, 20);
userRole.Font = GargiFontAndSize.B14();
userRole.TextColor = UIColor.White;
headerView.AddSubview(userRole);
headerView.AddSubview(profileImage);
TableView.TableHeaderView = headerView;
TableView.ContentInset = new UIEdgeInsets(20, 0, 0, 0);
GetUserItemData();
SetSidePanel();
}
其工作正常。
画面1:
,但是当我把它的滚动与状态栏干扰见下图。
屏幕2:
我已经尝试了几乎所有的解决方案或替代方法,但没有什么是我帮助。他们中的少数人在下面。
试过1:
TableView.ContentInset = new UIEdgeInsets(20, 0, 0, 0);
试过2:
TableView.ScrollRectToVisible(new CGRect(0, 0, 1, 1), true);
试过3:
EdgesForExtendedLayout = UIRectEdge.None;
ExtendedLayoutIncludesOpaqueBars = false;
AutomaticallyAdjustsScrollViewInsets = false;
我试图解决这个问题最近6个小时,但没有任何帮助。
任何帮助将被赞赏。
您正在给视图显示绑定呈现的整个屏幕的高度和宽度(window = new UIWindow(UIScreen.MainScreen.Bounds);)您需要为顶部状态栏留出空间。 – Digitalsa1nt
@ Digitalsa1nt等待我添加顶部状态栏高度并检查它。 – Ironman
@ Digitalsa1nt,但它也像NavigationBar和其他东西一样的整体布局。我想保持其他视图控制器与以前相同,但仅在'DummyControllerLeft'中进行更改,它扩展了'DialogViewController'。 – Ironman