Ionic2 always show left menu - ionic2

I am working on an mobile app with Ionic2. When I navigate using navController.push(SomePage) method, I get back button. I want to show left menu button always and disable back button. How can I achieve that?
Thanks and Regards

You can use hideBackButton attribute to hide the back button when push is used.
Ref - https://ionicframework.com/docs/api/components/navbar/Navbar/
For example:
<ion-header>
<ion-navbar hideBackButton>
...
</ion-navbar>
</ion-header>

Ok so I figured out that rather to use
navController.setRoot(somePage);
with parameter
navController.setRoot(somePage, {"id" : 123});

Related

Foundation 6 drilldown menu: add back event to custom button

The default js-drilldown-back button is not the way I like it.
Instead of having an entire li element for the back functionality I would like to trigger the back event on a custom element.
How to achieve this?
The documentation is everything but clear to me on how to do it: https://get.foundation/sites/docs/drilldown-menu.html#_back
$('#element').foundation('_back', $elem);
What is #element and what is $elem in this context?
For the time being I created an (ugly) workaround:
I let foundation render the default back button but I hide it via css.
My custom back button then triggers that button's event:
$('.drilldown .back').on('click', function(){
$(this).closest('.submenu').find('.js-drilldown-back > a')[0].click();
});
Not great, not terrible.

Android navigation component- With Login screens

When dealing with login screens, I am trying to work out the better approach - either execute navigation "action" to go to login fragment on first use (and hide back button to actual app), or start a new login activity (with its own nav graph). For the first approach (just using navigation components), I do not know the way to remove the back button without a hack "hide". I tried using navoptions, setpopupto etc., but it does not work. Code below:
val navOptions = NavOptions.Builder()
.setPopUpTo(R.id.home_fragment, true)
.build()
host?.navController?.navigate(R.id.action_global_signUpFragment_dest, null, navOptions)
Two questions then:
1) How to properly handle login transition with just navigation component?
2) Is starting a new login activity, with separate nav graph, a better idea?
I think the first approach is better.
To hide the 'back' button on your toolbar inside signUpFragment you can use AppBarConfiguration, and customize which destinations are considered top-level destinations.
For example:
val appBarConfiguration = AppBarConfiguration.Builder(setOf(R.id.home_fragment, R.id.signUpFragment_dest)).build()
NavigationUI.setupWithNavController(toolbar, navController, appBarConfiguration)
This way home_fragment and signUpFragment_dest will be considered top-level destinations, and won't have back button on toolbar.
Another option for solving the back button problem is how I did it here. Also, rather than show/hide the bottom nav bar, I have two NavHostFragment, one main full screen one, and one contained within the home fragment (above the bottom nav bar).
When I want to navigate to a full screen view I call this extension function,
fun Fragment.findMainNavController(): NavController =
Navigation.findNavController(activity!!, R.id.nav_host_fragment)
then navigate via the main graph.
This makes sense conceptually to me, to have parent and child nav graphs.

Repositioning Master View display button in Split View Controller

As you know, split view controller hides the master view and displays detail view in full screen mode in ipad. In the full screen mode, ios creates a bar button for the master view on the navigation bar. My question is, is it possible to reposition that button to the far right instead of left? Because my detail view is embedded inside a navigation view controller and there are severals views associated with it. It gets confusing when master view is hidden and the detail view has button to go back to the previous view.
In above screencap, "Category" is a button to display the masterview and "List of Events" is a back button. If you have better way to handle this situation, please feel free to suggest.
Yes, you can do it just send a NotificationCenter.default to the split view controller and change self.preferredDisplayMode in your splitview and coming to moving the category buttom u either can use the right bar button in navigationbar or create your custom navigation bar.
Hope this helps
For those who are having the same issue, I found a very simple solution. All you need to do is assign the rightBarButtonItems with leftBarButtonItems value and set the leftBarButtonItems to nil. Voila, that's about it.
if let leftButton = self.navigationItem.leftBarButtonItems {
self.navigationItem.rightBarButtonItems = leftButton
self.navigationItem.leftBarButtonItems = nil
}

Can I create a normal button while using foundation?

This is the code I'm using to create a button:
<button type="button">Click Me!</button>
And the button being created is the same as the default button that Foundation creates for you.
Is it possible to reset Foundation's style and make the button looks like a browser default one?

Sketchflow Navigation

I am new to Blend & Sketchflow. I hope someone can help me.
I have been doing a sketchflow project and have set up several buttons that navigate to specific screens (nice and easy).
Now the catch...
I have made a generic menu at the top, and have put a button on it, and what I want to achieve with it is that if someone clicks on that button, instead of navigating to a specific screen, it simply navigates to the previous screen that was viewed in sketchflow.
Does anyone know if this is possible? And if so, how I would achieve this?
Use the "back" behavior. There are 2 easy ways to apply this behavior to your button:
Right click the button in the artboard, select "Navigate To" -> "Back"
or
Open the assets panel, SketchFlow->Behaviors->NavigateBackAction, drag this behavior onto your button.
The xaml should look similar to this:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:pb="clr-namespace:Microsoft.Expression.Prototyping.Behavior;assembly=Microsoft.Expression.Prototyping.Interactivity"
x:Class="SilverlightPrototype12Screens.Screen_1"
Width="640" Height="480">
<Grid x:Name="LayoutRoot" Background="White">
<Button Height="66" Margin="241,68,275,0" VerticalAlignment="Top" Content="Button">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<pb:NavigateBackAction/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
I was looking for the same question, but I want to navigate from c#.net.
I found the following solution:
private void Navigate(object sender, RoutedEventArgs e)
{
Microsoft.Expression.Prototyping.Services.PlayerContext.Instance.ActiveNavigationViewModel.NavigateToScreen("WpfPrototype2Screens.Screen_2", true);
}
in this forum.