Using Xamarin Forms, how do I override the back button functionality? - uinavigationbar

Using Xamarin Forms, I have a MasterDetailPage whose Master is a list of menu options and Detail is a NavigationPage that contains a ContentPage. If I push a second page onto the Detail's NavigationPage, the icon that used to open the menu becomes a back button. I want to override this behavior so that icon always opens the menu. I have a subheader with a custom back button which is why I need the Detail to be a NavigationPage.

It's not possible out of the box. maybe using a custom render for the Navigation page.

This is possible now
NavigationPage.SetHasBackButton(page, false);
where page is the page you are about to push.

I found there are a lot of ways to make a new screen pop up with the Master Detail Page. The one that stopped the back button from showing up for me was:
((MasterDetailPage)Application.Current.MainPage).Detail = new NavigationPage(page);
where "page" is whatever screen you want to set it to. For example:
((MasterDetailPage)Application.Current.MainPage).Detail = new NavigationPage(new ResultsPage());

Related

How to connect a button to a new view controller iOS Swift?

I'm pretty new to Swift and am trying to connect a button to another View Controller. On other apps I have made with Swift I have been able to easily control-drag a button to another view controller, where it would display "show" as an option to click. When I would run it and click the button it would show the desired View Controller.
On the app I am working on, I was trying to add a settings page that could be accessed by clicking a button. When I tried to control-click and drag the button into the second view control, it displayed only three options: push, modal, and custom. I selected push, and when I ran the app and pressed the button it showed a SINABRT error. How can I connect a button to a second View Controller just by pressing it?
You will only see the "show" option if you are working on a project targeting iOS 8 and later, since it is a new feature to help you to determine the proper way to show your new view controller. It will opt to "push" if you are in a navigation controller and "modal" if you are in a regular controller context.
Here you might be working for a project with deploy target for iOS 7 or below. You can choose to use "modal" here to present the view controller from the bottom of screen and implement an exit button. Or you can embed your current view controller into a navigation controller to use "push" to make the new view controller pushed from right hand to left, with a back button to navigating back automatically.

How to add navigation drawer feature in later views(for ex: 2nd view) of the app?

I am trying to implement Navigation Drawer like menu on my iPhone project.
I have looked at the forums and find out there are many samples given in this link:
Stackoverflow Navigation drawer query
But, they have not helped me much. Because, all the apps are developed Navigation drawer in the Home screen(1st view) of the app itself and using window.rootViewController
My requirement is, I need Navigation Drawer like menu NOT in the home screen(1st view) of the app, rather need on the 2nd view of the app, hence I don't know how to add this feature.
Could someone please suggest me how to add navigation drawer like menu feature in later views(for ex: 2nd view) of the app?
I don't quite get how you want the menu. You can add Navigation Controller anywhere you want, all it's going to do is give you a Navigation Bar on which you can give a title and a Back button, usually with the name of the title of the previous page.
You can simply add the navigation where you want and control drag from the view or object you want to perform the segue. If it's a button you can use an IBAction with a performSegueWithIdentifier method.
Hope I could help

Apple watch page based without arrow to go back

I have a initial controller, that have a button with push segue to a dynamic page based navigation, when I do segue the go back arrow disappear, and I can not return to the initial view, how can I add a go back arrow to return?
when I go to the next controller with the button I have code to create dynamic page based
WKInterfaceController.reloadRootControllersWithNames(controllers as [AnyObject],contexts: contexts as [AnyObject])
these work well, and I have a page based navigation, but if I want to return I do not have the arrow.
You can't transition from a hierarchical navigation type to a page-based navigation type in a WatchKit app. They are exclusive - you have to use one or the other.
If you want to change from one to the other you have to present the new type as a modal.
Here's a link to the HIG explaining it: https://developer.apple.com/watch/human-interface-guidelines/app-components/

Switching between views in iOS app

I have a slide out menu in my app and each of the things in the menu goes to the respective pages.
Basically, when I tap "graph section" on the dashboard, I want it to go to the graph page without the Dashboard back button.
I've tried doing this with a modal segue but this provides a back button which means I can't access the menu on this page.
Anyone know how to do this?
I am not quite sure whether this answers it but have a look at:
Open View Controller programmatically and not using a Seque
I think you Use navigation controller.Once you hide the navigation controller for that particular page with [self.navigationController setNavigationBarHidden:YES]; and add UIButton and write it's action

Xcode - How to attach a tab bar to a view without adding a tab for the new view

I have an application which has 5 tabs. I also have another view which you can access from tab3 via a selection of buttons. I will call it view 3b. View 3b populates with information based on which button the user selected in view 3. After the user puts in all the information required the app automatically takes them back to view 3. I want to add the tab bar to this view(3b) but I do not want it to have its own tab. I just want to use it so the user can navigate out of this view back to the rest of the app if they want to exit the screen early. Does anyone know how I can attach the tab bar to this screen without having a tab added for this screen. I am using Xcode 4.6.2 and am using storyboards to set up my app.
Any help would be appreciated. I've done a bit of searching but everything I find just explains how to use tabs.
Any help would be appreciated. Thanks.
It sounds like you need to use a UINavigationController.
When you set up your UITabBarController, instead of linking the third tab directly to your 3rd view controller, connect it to a UINavigationController, and then set the root view of that UINavigationController as the UIViewController you want as your third tab.
From there, you can set up your buttons to perform a push segue to your second view controller (view 3b from your question). If you do this, not only will you keep the tab bar on view 3b, but a back button will automatically be placed in the top left of the page so the user can simply go back to view 3. If you don't want the navigation bar that appears to be there, you can instead uncheck the "shows navigation bar" checkbox in the UINavigationController's attributes inspector.
I hope this helps!

Resources