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