You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've spent long hour to modify sidebar navigation to hide status bar when side menu open. I want to create pull request but due to my lack of knowledge, I just wrote my code in this page.
In the "Xamarin-Sidebar-Unified" project, find the "Sidebar.cs" file and make some change with below code
Add HideStatusBar member variable in the line 99 public bool HideStatusBar { get; set; }
Add Default value of HideStatusBar in the SetDefaults() methods in the line 225 HideStatusBar = true;
Add the setstatusbarhidden method in the OpenMenu(), CloseMenu() method in the line 121 like this
public void OpenMenu()
{
if (IsOpen || Disabled)
return;
ShowShadow();
_sidebarContentArea.BeforeOpenAnimation();
// INSERT THIS CODE
if (HideStatusBar)
UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Slide);
// INSERT THIS CODE
UIView.Animate(
Sidebar.SlideSpeed,
0,
UIViewAnimationOptions.CurveEaseInOut,
() => {
_sidebarContentArea.OpenAnimation(MenuLocation, MenuWidth);
},
() => {
_sidebarContentArea.AfterOpenAnimation(TapGesture);
IsOpen = true;
});
}
public void CloseMenu(bool animate = true)
{
if (!IsOpen || Disabled)
return;
MenuViewController.View.EndEditing(true);
// INSERT THIS CODE
if(HideStatusBar)
UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Slide);
// INSERT THIS CODE
UIView.Animate(
animate ? Sidebar.SlideSpeed : 0,
0,
UIViewAnimationOptions.CurveEaseInOut,
() => { _sidebarContentArea.CloseAnimation(); },
() => {
_sidebarContentArea.AfterCloseAnimation(TapGesture);
IsOpen = false;
});
HideShadow();
}
Build the "Xamarin-Sidebar-Unified" project
Open the Project options and check the output path
In the output path folder, find the Xamarin-Sidebar-Unified.dll
I've spent long hour to modify sidebar navigation to hide status bar when side menu open. I want to create pull request but due to my lack of knowledge, I just wrote my code in this page.
In the "Xamarin-Sidebar-Unified" project, find the "Sidebar.cs" file and make some change with below code
Add HideStatusBar member variable in the line 99
public bool HideStatusBar { get; set; }
Add Default value of HideStatusBar in the SetDefaults() methods in the line 225
HideStatusBar = true;
Add the setstatusbarhidden method in the OpenMenu(), CloseMenu() method in the line 121 like this
Build the "Xamarin-Sidebar-Unified" project
Open the Project options and check the output path
In the output path folder, find the Xamarin-Sidebar-Unified.dll
Open your own project
Edit References -> .Net Assembly -> Browse -> (Above output path) -> select Xamarin-Sidebar-Unified.dll
Open Info.plist with text editor (like sublime text) to add this key value pair inside area
UIViewControllerBasedStatusBarAppearance
The text was updated successfully, but these errors were encountered: