I want to remove Tabbar from TabbedPage. I got it working by using CustomRenderer but it leaves blank space or page height is not updated after hiding Tabbar.
Note that when we swipe through the pages, the blank space goes and never comes back. This issue appears only for the first time.
I have tried from this link. But it doesn't work.
Also tried following in my renderer class
private void Element_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { try { TabBar.Hidden = true; //TabBar.Bounds = new CoreGraphics.CGRect(View.Subviews[0].Frame.X, View.Subviews[0].Frame.Y, // View.Subviews[0].Frame.Width, 0); if (TabBar.Hidden) { // page View.Subviews[0].Frame = new CoreGraphics.CGRect(0, 0, View.Subviews[1].Frame.Width, NativeView.Frame.Height); // Tabbar View.Subviews[1].Frame = new CoreGraphics.CGRect(View.Subviews[0].Frame.X, View.Subviews[0].Frame.Y, View.Subviews[0].Frame.Width, 0); } else { View.Subviews[1].Frame = new CoreGraphics.CGRect(View.Subviews[1].Frame.X, View.Subviews[1].Frame.Y, View.Subviews[1].Frame.Width, 49); View.Subviews[0].Frame = new CoreGraphics.CGRect(View.Subviews[0].Frame.X, View.Subviews[0].Frame.Y, View.Subviews[0].Frame.Width, View.Subviews[0].Frame.Height - 49); }
Is there any way to remove blank space for the first time also ?
Thank you
Put the code into the method ViewDidLayoutSubviews
,it works fine on my side .
[assembly: ExportRenderer(typeof(TabbedPage),typeof(MyRenderer))] namespace App18.iOS { class MyRenderer :TabbedRenderer { public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); TabBar.Hidden = true; var page = View.Subviews[0]; var tabbar = View.Subviews[1]; tabbar.Bounds = CGRect.Empty; page.Bounds = UIScreen.MainScreen.Bounds; } } }
Answers
Put the code into the method
ViewDidLayoutSubviews
,it works fine on my side .Thank you @ColeX for the answer. It Worked !!!
@ColeX This is not working on iOS 13 any ideas?